Decorators: an outsider's perspective
anthonybaxter at gmail.com
Mon Aug 16 07:01:11 CEST 2004
On Sun, 15 Aug 2004 13:43:30 -0400, Paul Morrow <pm_mon at yahoo.com> wrote:
> Define fragile. If you mean, easy to break, I don't see it. There
> would be only one way to define an instance method: name its first
> parameter 'self'. There would be only one way to define a class method:
> name its first parameter 'klass' or 'cls' (or some other synoynm that we
> can all vote on). All other methods would be static methods.
> How is that fragile?
Python currently doesn't _care_ about the argument list, and the variable
names in it.
Adding this sort of behaviour is nasty. How, for instance, would you handle
adding a method to a class at runtime? Do you poke into the newly added
method to make sure you get it right? Do you not do this?
What about for more complex decorators? Remember, staticmethod and
classmethod are the trivial cases that this feature addresses. How do you
handle the more complex ones?
More information about the Python-list