A decorator syntax not yet mentioned (I think!)

Peter Hansen peter at engcorp.com
Thu Aug 12 00:33:23 EDT 2004


Carl Banks wrote:

> steven.bethard at gmail.com (Steven Bethard) wrote in message news:<d11dcfba.0408111433.43f025f8 at posting.google.com>...
> 
>>I know there were complaints before about this sort of indentation,
>>but I couldn't find them in python-dev and the comments in the wiki
>>don't discuss this in any detail.  Can anyone tell me why this
>>indentation syntax was dispreferred?  Specifically, I'm interested in
>>why this is so drastically different from the other paired blocks:
>>if/elif/else, try/except, try/finally, etc. 
> 
> One thing that's different is that, in all those cases, the second
> block has a keyword that can't appear alone.  You can't have an except
> without a try, or an else without an if, but you could have a def
> without a decorate.

Is this merely a pedantic argument (not sure I use "pedantic" correctly)
or is this an argument based on presumed difficulties in implementing
the idea?

I ask because I'm not sure the issue matters to anyone writing
or reading the code.  It certainly wouldn't bother me that
with if/else it's the first part that's required, while with
decorate/def it's the second part.

-Peter



More information about the Python-list mailing list