Barry Warsaw <barry <at> python.org> writes: > Just what /is/ the contract for a decorator function? Maybe that it > takes a function/method object and must return a descriptor? I do think > this needs some clarification in the PEP. It would be really spiffy if the decorator were able to run the decorated function and then have access to the function's locals dictionary. It would then be possible to define a property like so: class Foo(object): def bar(self) [property]: """ bar property docstring """ def get(self): return self.__bar def set(self, bar): self.__bar = bar The property decorator would reach inside the locals dictionary amd pull out the special names 'get', 'set' and 'delete', and use them to construct the property descriptor. -- Alan. --
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