-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Zvezdan Petkovic wrote:
On Feb 19, 2009, at 11:03 AM, Jim Fulton wrote:
I sort my imports. Period. This makes from imports come before regular imports (because f comes before i). I discourage from imports, so this isn't much of an issue for me except for old code. Having imports sorted takes very little effort and makes imports easier to find and duplicated easier to spot. Grouping imports makes imports harder to maintain and read, especially since groupings are arbitrary unless they follow package boundaries, and just sorting imports groups imports by package boundaries.
Exactly . As I mentioned in the previous post, sorting is the *key* here. [Pun intended]. Grouping (python, zope., myapp. modules order), or non-grouping, becomes a non-issue when imports are sorted.
+1
- -1. I prefer the PEP8 grouping, where "stdlib" imports are separated from "dependecy" imports, which are separated from "local" imports. Note that this is *not* subjective (an import is unambiguously in exaclty one of those three classifications.)
BTW, I strongly discourage from imports. (I didn't always have this opinion, but have seen the error of my ways. Thanks to Fred Drake for nudging me in this direction.) IMO, this is wildly more important than any of the issues raised in this thread.
Very important for code maintenance/readability! +1
- -1, especially in heavily-namespaced libraries: I vastly prefer from imports to the noise of repeating the module path everywhere. A one chearacter search ('*' or '#') normally finds the import for me, which makes the repetition useless. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJnZpA+gerLs4ltQ4RAp3lAKDOVsZjLoWT9LmHxeY/KpXRmk+x5gCfdUmX kx9JhthFuPgaEXokLVLo+r4= =Vi9G -----END PGP SIGNATURE-----