On 14 July 2014 10:33, Ben Hoyt <benh...@gmail.com> wrote: >
If we go with Victor's link-following .is_dir() and .is_file(), then > we probably need to add his suggestion of a follow_symlinks=False > parameter (defaults to True). Either that or you have to say > "stat.S_ISDIR(entry.lstat().st_mode)" instead, which is a little bit > less nice. > Absolutely agreed that follow_symlinks is the way to go, disagree on the default value. > Given the above arguments for symlink-following is_dir()/is_file() > methods (have I missed any, Victor?), what do others think? > I would say whichever way you go, someone will assume the opposite. IMO not following symlinks by default is safer. If you follow symlinks by default then everyone has the following issues: 1. Crossing filesystems (including onto network filesystems); 2. Recursive directory structures (symlink to a parent directory); 3. Symlinks to non-existent files/directories; 4. Symlink to an absolutely huge directory somewhere else (very annoying if you just wanted to do a directory sizer ...). If follow_symlinks=False by default, only those who opt-in have to deal with the above. Tim Delaney
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com