[Python-Dev] PEP 8 updates/clarifications
Ian Bicking
ianb at colorstudy.com
Tue Dec 13 17:17:31 CET 2005
Jim Fulton wrote:
>> stdlib, external modules, internal modules seems like enough ordering
>> to me. If you want to order things more exactly, sure, but I don't
>> really see the point personally. Since I can't assume as a reader
>> that imports are ordered in any way I have to search to be sure of
>> what's there. The grouping help me browse, but I'd hope that the
>> import list is short enough that I don't need to use alphabetization
>> to scan for a module.
>
>
> Personally, I don't find the stdlib/external distinction to be useful.
I like the stdlib coming first, because (if it's not using "from")
stdlib imports are just line noise and I don't pay any attention to
them. I care if a module uses an external package, but I don't care
what stdlib packages it uses (I'd actually like to be able to avoid
importing them at all, but that's an aside:
http://blog.ianbicking.org/py-std.html). So I don't really care what
comes first, just that stdlib imports are grouped together so I can
ignore them, and first is as good a place as anything. "from...import"
is a different matter of course, because I need to look at those to see
where names come from.
Additionally, having the local packages grouped together helps make up
for the non-distinction of absolute and relative imports.
--
Ian Bicking / ianb at colorstudy.com / http://blog.ianbicking.org
More information about the Python-Dev
mailing list