"Brock Filer" <filerba at softhome.net> wrote in message news:ffdbcc8dcfa9ff84b34b3285e4d213a5 at softhome.net... > countries['us']['Colorado']['Denver']['@population'] > > This is going to be used in user-input formulae, so I'm willing to do a > lot of work for minor beautifications. I'd like to be able to say (I > know, the quotes are still ugly, but at least you save a bracket): > > countries/'us'/'Colorado'/'Denver'/'@population' > > That's easy to do with a __div__ method, but it only works for getting, > not setting or deleting. > > I'd appreciate any thoughts on this problem. I personally would first try to dump the quotes and use standard attributes -- countries.us.Colorado... -- and the __get/set/delattr__ methods. > I keep thinking descriptors might be involved somehow in the solution, > but I may be on a completely wrong track. As far as I know, 'descriptor' is a behind-the-scenes concept, not something you directly program with. Perhaps you meant 'property'. However, properties are fixed in number when you create the class. Terry J. Reedy
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