9 Aug
2020
9 Aug
'20
1:22 a.m.
The property decorator, with its .setter and .deleter chaining, is a bit cumbersome and repetitive. If we can add `.apply` as a method on property that calls a function that returns the fget/fset/fdel/doc arguments, it would simplify instantiating the descriptor. For example: @property.apply def attr(): def fget(self): pass def fset(self, value): pass def fdel(self): pass return (fget, fset, fdel, "doc") instead of @property def attr(self): pass @attr.setter def attr(self, value): pass @attr.deleter def attr(self): pass An example implementation using `fproperty` exists at https://github.com/serwy/fproperty
1349
Age (days ago)
1349
Last active (days ago)
2 comments
2 participants
participants (2)
-
Roger Serwy
-
Steven D'Aprano