Decorators: an outsider's perspective

Istvan Albert ialbert at mailblocks.com
Sun Aug 15 12:06:25 EDT 2004


Paul Morrow wrote:


> That reminds me of how I once thought about using indentation as a means 
> of denoting code blocks.  How idiotic I thought that was.  Now I realize 
> the elegance, beauty, 'genius' in that.

I disagree. In C (Perl, Java etc) we would do three things,
write braces, indent and put the semi-colon. In python we replaced
these three, with a single (the most obvious) one the indentation.

> Why don't we all just acknowledge that we are doing this?  Why don't we 
> all just admit that a well written instance method uses 'self' as its 
> first argument.  And well written static or class methods (as well as 

If so then, the logically equivalent solution would be to pass self
as an implicit parameter, say a named parameter self with a default
reference to itself. I'm not suggesting this behavior, I only point out
what I think follows from the first example. The end goal is to
simplify the behavior not overload it and thus add
further meaning to it.

I do agree with Chas Emerick in that encoding special behavior in
variable names is a fragile solution.

Istvan.




More information about the Python-list mailing list