descriptors for container items

Brock Filer filerba at softhome.net
Sat Sep 3 23:43:36 EDT 2005


> > If I do that, the attributes (that was a stupid name for me to 
> choose)
> > and children would have to not share any names with each other,
>
> Since multiple objects can indeed have duplicate attribute names, and 
> such
> duplication is rampant in Python, I am not sure what you mean.

felons['@class'] = 'capital'
felons['class'].do_something()
felons.class -> SyntaxError

I thought I had my previous example down to:

countries/'us'/'Colorado'/'Denver'['@population']

, but of course that tries to subscript a string with a string; which 
might be an interesting idiom for substring searching, as long as it 
never returned -1.




More information about the Python-list mailing list