Message211416
| Author |
the.mulhern |
| Recipients |
the.mulhern |
| Date |
2014年02月17日.13:43:56 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1392644637.44.0.107261446205.issue20659@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The problems is that it is quite possible to define a property using @property in a class and then later to realize that it really ought to be a class method, not an instance method. But then, if you change it to a class method, using @classmethod annotation, the @property annotation will fail to work. If you are a pedantic person, and name your properties differently than you name your methods, you have to:
1) Change all uses of this former property back to method invocations, with a "()"
2) Change the name, so it now reflects that it is an actual function, not a property any longer.
I think an @classproperty and an @staticproperty decorator would take this problem away.
An alternative would be to make it possible to chain @property and @classmethod. I know that this is sort of doable for ABC.abstractproperty which is now deprecated in favor of @property combined with @ABC.abstractmethod. This would be ideal, but I can not pretend to know if it would be possible. Also, I suspect that the order would matter as it does for ABC as described in http://bugs.python.org/issue16267. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年02月17日 13:43:57 | the.mulhern | set | recipients:
+ the.mulhern |
| 2014年02月17日 13:43:57 | the.mulhern | set | messageid: <1392644637.44.0.107261446205.issue20659@psf.upfronthosting.co.za> |
| 2014年02月17日 13:43:57 | the.mulhern | link | issue20659 messages |
| 2014年02月17日 13:43:56 | the.mulhern | create |
|