Python syntax wart

J. Cliff Dyer jcd at sdf.lonestar.org
Mon Sep 10 06:40:27 EDT 2007


J. Cliff Dyer wrote:
> Lawrence D'Oliveiro wrote:
>> In message <5khuq4F3ij9eU1 at mid.individual.net>, Bjoern Schliessmann wrote:
>>
>>   
>>> What's wrong with this:
>>>
>>> for Link in GetEachRecord(
>>>     
>>
>> Then you're no longer showing the syntax structure in two dimensions.
>>
>>   
> If somebody handed me a program of more than twenty five lines that 
> was formatted "two dimensionally" as you call it, and asked me to deal 
> with it, the first thing I would do is reformat the code  so a not to 
> be so hideously ugly.  Your style has the unfortunate consequence of 
> requiring the reader to scroll ridiculous distances, making it more 
> difficult to maintain.  I do see the benefit of using multiple lines 
> on complex statements, such as:
>
> if (actor == 'Tony Leung'
>         or actor == 'Alec Baldwin'
>         or actor == 'Divine'
>         or actor == 'Fitty-cent'
>         or actor == 'Sir Ian McKellen'):
>     go_see_the_movie()
>
> but even here, there is some attempt to keep things compact by making 
> each line meaningful.
>
> However, I utterly fail to see how putting the word "or" on its own 
> line, (or worse: "if!") clarifies things in the slightest. 
>
> Part of the point of designing python with a line break as the 
> statement closer is to encourage you to write in a style that treats 
> each line as a statement.  Changing the syntax to encourage people to 
> violate this principle would not be an improvement to the design, but 
> a relinquishing of basic principles.  Obviously there are some cases 
> where you want to do something different, but that's what backslashes 
> are for.  Frankly, I find your code just as ugly without the 
> backslashes as it is with them.
>
> Cheers,
> Cliff
>

I replied to poster instead of to list.  My apologies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070910/48638c2b/attachment.html>


More information about the Python-list mailing list