<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 14 July 2014 10:33, Ben Hoyt <span dir="ltr"><<a href="mailto:benhoyt@gmail.com" target="_blank">benhoyt@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
If we go with Victor's link-following .is_dir() and .is_file(), then<br>
we probably need to add his suggestion of a follow_symlinks=False<br>
parameter (defaults to True). Either that or you have to say<br>
"stat.S_ISDIR(entry.lstat().st_mode)" instead, which is a little bit<br>
less nice.<br></blockquote><div><br></div><div>Absolutely agreed that follow_symlinks is the way to go, disagree on the default value.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Given the above arguments for symlink-following is_dir()/is_file()<br>
methods (have I missed any, Victor?), what do others think?<br></blockquote><div><br></div><div>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:</div>
<div><br></div><div>1. Crossing filesystems (including onto network filesystems);</div><div><br></div><div>2. Recursive directory structures (symlink to a parent directory);</div><div><br></div><div>3. Symlinks to non-existent files/directories;</div>
<div><br></div><div>4. Symlink to an absolutely huge directory somewhere else (very annoying if you just wanted to do a directory sizer ...).</div><div><br></div><div>If follow_symlinks=False by default, only those who opt-in have to deal with the above.</div>
<div><br></div><div>Tim Delaney</div></div></div></div>