Automatically organize module imports

Thomas Wittek mail at gedankenkonstrukt.de
Mon Oct 15 14:52:11 EDT 2007


Hi!

Is there any possibility/tool to automatically organize the imports at
the beginning of a module?

I don't mean automatic imports like autoimp does as I like seeing where
my objects/functions really come from.
For the same reason I don't like "from foo import *".

The downside is that you have a rather verbose import section at the
beginning of your code.
That's very bad if you reorganize your code and some imports are not
needed anymore or new imports are needed.
In Eclipse/Java there is a nice feature that automatically organizes
your imports, meaning that it removes unneded imports and even adds
missing imports automatically.

Unfortunately, this PyDev doesn't have an equally powerful feature.
As of the current version it only sorts the imports alphabetically, what
isn't very useful.

So, is there anything I can do about my imports?
Is there a tool that can organize my import section?
Shall I fall back to ambiguous imports like *?
Shall I write out the module name for every class/function that I use
(quite unhandy)?

Thank you!
-- 
Thomas Wittek
Web: http://gedankenkonstrukt.de/
Jabber: streawkceur at jabber.i-pobox.net
GPG: 0xF534E231



More information about the Python-list mailing list