what is wrong with this property setter
Nagy László Zsolt
gandalf at shopzeus.com
Thu Jun 9 05:15:12 EDT 2016
More information about the Python-list mailing list
Thu Jun 9 05:15:12 EDT 2016
- Previous message (by thread): what is wrong with this property setter
- Next message (by thread): what is wrong with this property setter
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>> Yes, and more. That property will also have a get method! Is it >> intentional? > It's a logical effect of how the setter() method works. The above is > syntactic sugar for > > def set_parent(...): > ... > set_parent = parent.setter(set_parent) > > and parent.setter() creates a new property basically like this > > def setter(self, fset): > return property(self.fget, fset, ...) This I could not find, because property is a built-in. But I believe you. :-) > > Not very elegant, but I don't see a cleaner alternative. It can be used to define an alternative setter for the same property, but it is bad practice. Thank you for the clarification.
- Previous message (by thread): what is wrong with this property setter
- Next message (by thread): what is wrong with this property setter
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list