T
Thomas Guettler
Hi,
why have classmethods only readonly attributes? It works for other methods.
exmpale code:
{{{
class Foo(object):
@classmethod
def bar(cls):
pass
bar.myattr='test'
}}}
user@host:~> python ~/tmp/t.py
Traceback (most recent call last):
File "/home/user/tmp/t.py", line 1, in <module>
class Foo(object):
File "/home/user/tmp/t.py", line 5, in Foo
bar.myattr='test'
TypeError: 'classmethod' object has only read-only attributes (assign to .myattr)
why have classmethods only readonly attributes? It works for other methods.
exmpale code:
{{{
class Foo(object):
@classmethod
def bar(cls):
pass
bar.myattr='test'
}}}
user@host:~> python ~/tmp/t.py
Traceback (most recent call last):
File "/home/user/tmp/t.py", line 1, in <module>
class Foo(object):
File "/home/user/tmp/t.py", line 5, in Foo
bar.myattr='test'
TypeError: 'classmethod' object has only read-only attributes (assign to .myattr)