On 02:01 pm, guido at python.org wrote: >On 10/31/07, glyph at divmod.com <glyph at divmod.com> wrote: >>As long as we're all tossing out ideas here, my 2ยข. I vastly prefer >>this: >> >> @property.set >>to this: >> > @property.set(attribute) >I don't approve of it. It has always been and will always >continue to be my position that these are semantically unkosher, >because it means that you can't wrap them in convenience functions or >invoke them in different contexts, and that means that the semantics >are hard to explain. Point taken. >If you really want another argument, repeating the property name >actually does have an additional use case: you can have a read-only >property with a corresponding read-write property whose name differs. I don't actually have this use-case, but it does make the actual semantics of the provided argument a bit clearer to me. It's not an implementation detail of fusing the properties together, it's just saying which property to get the read accessor from. This is a minor nit, as with all decorators that take an argument, it seems like it sets up a hard-to-debug error condition if you were to accidentally forget it: @property def foo(): ... @property.set def foo(): ... would leave you with 'foo' pointing at something that wasn't a descriptor at all. Is there a way to make that more debuggable?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4