Are decorators really that different from metaclasses...

Paul Morrow pm_mon at yahoo.com
Sun Aug 29 13:30:49 EDT 2004


Anthony Baxter wrote:
> On Sun, 29 Aug 2004 12:10:13 -0400, Paul Morrow <pm_mon at yahoo.com> wrote:
> 
>>For example, in the following function def, the comments specify (what I
>>believe is) the author's intention behind each assignment.
>>
>>    def circu(diameter):
>>       """Info about circu."""        # defines circu.__doc__
>>       __author__ = 'Paul Morrow'     # defines circu.__author__
>>       __features__ = memoized        # defines circu.__features__
>>       pi = 3.14                      # local variable definition
>>       return pi * diameter
> 
> 
> Not in any Python I know of. I look at that and I think "oo, local variables". 
> 
> That you have a different belief doesn't make it right - I remain
> _extremely_ unconvinced.
> 
> Anthony

My belief doesn't make it right, that's true.  But I think that a 
preponderance of supporting evidence does.

Have you seen a significant number of cases where a function uses 
__xxx__ attributes as local variables?  Have you seen any?

Can you craft a function definition that uses __xxx__ attributes as 
local variables, where the majority of experienced Pythonistas would 
agree that the double underscores are warranted?

Paul





More information about the Python-list mailing list