Are decorators really that different from metaclasses...

Paul Morrow pm_mon at yahoo.com
Sun Aug 29 20:28:34 EDT 2004


David Eppstein wrote:

> 
> So we really need to return to the FORTRAN days where variables have 
> different semantics depending on their first character?

A little of that is a good thing (IMO).  The alternative is that we 
explicitly declare each variable's semantics, which makes for a much 
more wordy language.



> Anyway, regardless of whether it's a local variable or an attribute, if 
> it's in the function body I expect it to be executed at call time not 
> def time.
> 

I believe that we should think of assignments to __xxx__ attributes as 
not being part of the function's body, but instead part of its 
declaration, just as we do with its docstring.

    def circum(diameter):
        """This describe's foo."""
        __author__ = 'Paul Morrow'
        __version__ = '0.1'
        __features__ = synchronized, memoized
        # Everything above here is declaration.
        # Everything below here is in the body.
        pi = 3.14
        return pi * diameter



Paul




More information about the Python-list mailing list