On Mon, 15 Oct 2007 20:52:11 +0200, Thomas Wittek <[EMAIL PROTECTED]> wrote: >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)? >
Pyflakes will tell you which imports aren't being used (among other things). I don't know if an existing tool which will automatically rewrite your source, though. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list