setattr(func, '_special_attr_', 'something something')
return func
# end def
class Foo(object):
@decorator
@classmethod
def method_one(cls, gnerf):
return gnerf
# end def
# end class
For some reason Foo.method_one._special_attr_ is unset.
If I switch however the @classmethod one to be outermost, i.e.
@classmethod
@decorator
def method_two(cls, gnerf):
return gnerf
# end def
that would work. Any clue why that is happening, and how I can support the first one as well?
That's actually because a classmethod is not really a function object anymore
Обсуждают сегодня