[Python-Dev] anonymous blocks

Guido van Rossum gvanrossum at gmail.com
Thu Apr 21 17:59:43 CEST 2005


> In case my point about the difference between thunks and other
> callables (specifically decorators) slipped by, consider the
> documentation for staticmethod, which takes a callable.  All the
> staticmethod documentation says about that callable's parameters is:
>     "A static method does not receive an implicit first argument"
> Pretty simple I'd say.  Or classmethod:
>     "A class method receives the class as implicit first argument,
>      just like an instance method receives the instance."
> Again, pretty simple.  Why are these simple?  Because decorators
> generally pass on pretty much the same arguments as the callables they
> wrap.  My point was just that because thunks don't wrap other normal
> callables, they can't make such abbreviations.

You've got the special-casing backwards. It's not thinks that are
special, but staticmethod (and decorators in general) because they
take *any* callable. That's unusual -- most callable arguments have a
definite signature, think of map(), filter(), sort() and Button
callbacks.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list