[Python-ideas] 80 character line width vs. something wider

MRAB google at mrabarnett.plus.com
Tue May 19 19:45:21 CEST 2009


David Stanek wrote:
> I'll bite.
> 
> On Tue, May 19, 2009 at 12:43 PM, Aaron Rubin
> <aaron.rubin at 4dtechnology.com> wrote:
>> 1) Python is three things which the standard was not designed for:  One:
>> Object Oriented.  Two: Not Hungarian notation  Three: Mandatorily uses
>> *whitespace* as its defintion for code blocks.  Let me explain each one in a
>> bit more detail:
>>   Object Oriented:  Because it is not functional-style programming, but
>> instead OO, you have to give defintion as to what object type you are using
>> before using it.  This makes definitions and usage longer than in functional
>> programming (when 80 character widths were invented).
>>  PhazeMonkey.Hardware.FrameSource.Abstract.Framegrabber is an example (and
>> not an extreme one) of a class (55 characters already) in a rather large
>> code base.
> 
> If you are using more than 5 or 6 levels of indentation you may be
> doing something wrong. I would guess that your methods are too complex
> or maybe you are violating the SRP.
> 
If there are too many lines or too much indentation then it's time to
move some of the code into a function.

>>   Not Hungarian:  Not only is Python not Hungarian (in general), but the
>> PEP-8 specifically tells us to use longer, more descriptive variable names.
>>  hasInstrumentControllerPhaseDither is an example.  Many variables are 15-20
>> characters and oftentimes longer.  How many of these variables can you fit
>> into a line if we are limited to 80?
> 
> I'd like to see an example of your variable names. I don't use
> hungarian notation and my name are usually under 10 characters.
> 
[snip]

IMHO, the names should be long enough to be meaningful but not too long.



More information about the Python-ideas mailing list