J2 paper 0.2.1

Robert Brewer fumanchu at amor.org
Tue Aug 24 13:11:08 EDT 2004


Greg Chapman wrote:
> Note that this:
> 
> <token>:
>     memoize
>     classmethod
>     synchronize
>     funcattrs(author="Guido van Rossum")
> def foo(cls, *args):
>     pass
> 
> is probably broken, at least given most of the proposed 
> implementations, in which classmethod and staticmethod
> would have to be either first or last.

Thanks! Fixed.

> Also this:
> 
> "In contrast, the current Python decorator proposal provides the exact
> opposite--all decorators accept one function and return one 
> function. Although
> they are not required to return a new function, or change 
> function signatures or
> calling semantics, many will, including the most common 
> decorators, classmethod
> and staticmethod."
> 
> is wrong in that classmethod and staticmethod do not return 
> functions (or even
> callables), which is why they have to be in a special place.

However, they "change calling semantics" both for the caller (
Thing.method() versus Thing().method() ) and the callee (instead of
receiving self as the first arg, they receive cls or nothing). I'll try
to think of a way to rewrite it where that's more clear.

Thanks for the comments!


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org



More information about the Python-list mailing list