|
||||
|
First of all I must state that I agree with all who think this is un-pythonic. but considering the facts, I can not do anything about it.... thus to the purpose of this post: If you go for it, go all the way!!! I just set up Py2.4a2 and found out the following (can't say I am surprised): - you can not decorate anything but a function!! this is a shame, as it would be logical to expect this to work for the following cases: 1) variables/attributes Example: class A(object):
@readonly
someattr = 0
or @register_in_store obj = SomeClass() 2) classes Example: @prepare
class A(object):
someattr = 0
each and every of the above cases currently generates a syntax error. P.S. I'm thinking of posting this as a bug or feature request (but it needs more thought before I do).... |
||||
|
|
