<div dir="ltr"><div dir="ltr" class="gmail_msg"><devils-advocate></div><div dir="ltr" class="gmail_msg">the same is true for files: Deciding to iterate them line-wise is relatively arbitrary, byte/char-wise would be equally intitive. So something could be chosen.</div><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"></devils-advocate></div><br class="inbox-inbox-Apple-interchange-newline"></div><div class="gmail_msg">But I think being explicit in the case of paths is really not that inconvenient.</div></div><br class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">Serhiy Storchaka <<a href="mailto:storchaka@gmail.com" class="gmail_msg" target="_blank">storchaka@gmail.com</a>> schrieb am So., 26. Feb. 2017 um 16:14 Uhr:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 26.02.17 15:39, Vamsi Krishna Avula wrote:<br class="gmail_msg">
> This is somewhere between a question and a proposal. I'm just trying to understand why Path objects use an explicit iterdir method.<br class="gmail_msg">
> Why not make them iterable?<br class="gmail_msg">
<br class="gmail_msg">
Because this is ambiguous. Iterating can mean many different things:<br class="gmail_msg">
<br class="gmail_msg">
1. Iterate characters of string representation of the path (str(path)).<br class="gmail_msg">
<br class="gmail_msg">
2. Iterate path components (path.parts).<br class="gmail_msg">
<br class="gmail_msg">
3. Open a file and iterate its lines (path.open()).<br class="gmail_msg">
<br class="gmail_msg">
4. Iterate files in the directory (path.iterdir()).<br class="gmail_msg">
</blockquote></div></div>