[Twisted-Python] Coding standard question: flowing long imports with parens

Glyph Lefkowitz glyph at twistedmatrix.com
Mon Dec 21 11:10:19 EST 2009


On Dec 21, 2009, at 10:20 AM, James Y Knight wrote:

> On Dec 21, 2009, at 12:03 AM, Jonathan Lange wrote:
>> Now that we no longer support Python 2.3, may we also allow imports in
>> the following style?
>> 
>> from very.long.package import (
>>   bar,
>>   foo,
>>   )
> 
> 
> Separating "from X import" and "Y" over a newline totally breaks  
> grepping for imported modules. I'd not use it myself, purely because  
> of that, except perhaps when the "Y"s are functions in a module,  
> rather than modules.

I'm a fan of this style, because it's easier to read and it involves a lot less duplication... at the same time, I can see the 'grep' case.  Anybody want to write a tool which uses the AST to look for name imports?  This would generally be handy anyway :).




More information about the Twisted-Python mailing list