By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,818 Members | 1,223 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,818 IT Pros & Developers. It's quick & easy.

descriptors for container items

P: n/a
.... or something like that.

I have an XMLish data structure whose nodes' __get/set/del item__
methods resolve as:

node['foo'] -> node.children['foo']
node['@bar'] -> node.attributes['bar']

so you can say:

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 keep thinking
descriptors might be involved somehow in the solution, but I may be on
a completely wrong track.

Sep 2 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.