Can isfile() and isdir() functions both evaluate to False?
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Flying Over Ancient Lands
--
Chapters
00:00 Question
01:06 Accepted answer (Score 3)
01:59 Thank you
--
Full question
https://stackoverflow.com/questions/5263...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Flying Over Ancient Lands
--
Chapters
00:00 Question
01:06 Accepted answer (Score 3)
01:59 Thank you
--
Full question
https://stackoverflow.com/questions/5263...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python
#avk47
ACCEPTED ANSWER
Score 3
Is it possible for a file f that os.path.isfile(f) and os.path.isdir(f) both evaluate to false?
yes .. if you ask for existence os.path.exists(f).
EDIT: to answer your more detalied question ..
Would the union of B and C be equal to A?
Normaly yes .. if you can assert that none of them is deleted in the meantime.
Take into account that dead links are not exists, which means that os.path.exists(deadlink) of a (existing) link pointing to a dead end results in False while os.path.islink(deadlink) results in True, no matter if it points to a existing object or a dead end.