> Question: how could the descriptor "know" the name "x" if it is created > by a descriptor-creating statement such as x = descriptor_creator(...). > I guess one could do this by making a metaclass that would look for the > descriptors in the class and "poke" the name into them but is there > another way? In the example below I evaded this question by making the > name an argument to positive's constructor. Yes, those are the only ways I know of. In retrospect it might have been useful to give the descriptor API an extra argument for the attribute name, but it's a bit late for that now. --Guido van Rossum (home page: http://www.python.org/~guido/)
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