开发者

Property as a decorator in Python 2.4?

开发者 https://www.devze.com 2023-03-22 07:49 出处:网络
I\'m developing an application for someone who is tied down to Python 2.4.开发者_C百科 According to the Python builtins page\'s description of property that \"the getter, setter, and deleter attribute

I'm developing an application for someone who is tied down to Python 2.4.开发者_C百科 According to the Python builtins page's description of property that "the getter, setter, and deleter attributes were added" in Python 2.6. Is there still a way to use property as a decorator, or is it imperative to use the x = property(...) syntax?


You can use it as a decorator, but you can only specify a getter if you do so. You can delete the getter, setter, and deleter methods once you have called property() though.

0

精彩评论

暂无评论...
验证码 换一张
取 消