Reduce need of backslash

Nicolas Fleury nid_oizo at yahoo.com_remove_the_
Fri Sep 26 22:27:23 CEST 2003

Pettersen, Bjorn S wrote:
> Seriously though, long lines are a sure sign that you're doing too much
> per line. The obvious solution is to pull out subexpressions and assign
> them to meaningful temporary variable names until you're within 25x80.
> When someone wants to fix a bug in your code a year from now it will
> also be easier for them to figure out what you were trying to do
> (potentially saving you time :-)

It's probably not intentional, but I find that comment vexing.  For 
example, I have Mark Lutz "Programming Python" in my hands and there's 
long lines everywhere and I consider this code properly commented and 
maintainable.  Even if I'm relatively new to python, I'm an experienced 
programmer and I think I can measure and not abuse of long instructions. 
  Sorry to overreact ;)

>>    parser.StartElementHandler = (lambda name, attrs:
>>        GenericParser.handleElementStart(self, name, attrs))
> A lambda that doesn't fit on one line is way to obscure... It needs a
> comment to justify it's existence, so might as well do it right <wink>:

Come on, that is not obscure at all.  I agree your solution is more 
scalable but in that case it is intended to be not needed since the 
lambda is only used to make a method callback.



More information about the Python-list mailing list