staticmethod with property
24 Aug
2021
24 Aug
'21
11:55 p.m.
Currently Python does not support using `@staticmethod` decorator along with `@property` decorator. I think that the it currently works is a bit misleading since it will not give an error, but gives the following outcome. ``` class Foo: @staticmethod @property def bar(): return "1" ``` ``` class Foo: @property @staticmethod def bar(): return "1" ``` In wither of the cases the outcome is the following ``` Foo.bar
a = Foo() a.bar
Is there any particular reason for this? Any don't we make it work?
946
Age (days ago)
947
Last active (days ago)
2 comments
3 participants
participants (3)
-
Antoine Rozo
-
Henry Harutyunyan
-
Steven D'Aprano