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
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/VO537YXAALG3C2QJXEI5T7BPNV3ZHM5T/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to