Re: [IronPython] staticmethod / classmethod and setattr

2008-02-06 Thread Curt Hagenlocher
Nice find, thanks. I guess I won't feel so bad about requiring a specific order when defining static methods for "CLR export". On Feb 6, 2008 3:46 PM, Michael Foord <[EMAIL PROTECTED]> wrote: > From http://www.ddj.com/web-development/184406073 > > Usually, most decorators expect a function on i

Re: [IronPython] staticmethod / classmethod and setattr

2008-02-06 Thread Michael Foord
From http://www.ddj.com/web-development/184406073 Usually, most decorators expect a function on input, and return either a function or an attribute descriptor as their output. The Python built-ins classmethod, staticmethod, and property all return attribute descriptors, so their output cannot

Re: [IronPython] staticmethod / classmethod and setattr

2008-02-06 Thread Michael Foord
Not really an answer but possibly an explanation. staticmethod and classmethod are descriptors that wrap callable objects. Because they are implemented in C they us __slots__ and you can't set arbitrary attributes on them. Michael Curt Hagenlocher wrote: > This is really more of a Python quest

[IronPython] staticmethod / classmethod and setattr

2008-02-06 Thread Curt Hagenlocher
This is really more of a Python question than an IronPython question, but I'm not currently on any non-Iron Python lists. :) The following definition results in an error under both CPython 2.5 and IronPython. Decorating a method as static or class prevents attributes being set on the resulting de