The trouble with "dynamic attributes".

Cameron Simpson cs at zip.com.au
Fri Sep 17 23:07:41 CEST 2010


On 17Sep2010 10:53, Ethan Furman <ethan at stoneleaf.us> wrote:
| Lie Ryan wrote:
| [snip]
| >And even dict-syntax is not perfect for accessing XML file, e.g.:
| >
| ><a>
| >    <b>foo</b>
| >    <b>bar</b>
| ></a>
| >
| >should a['b'] be 'foo' or 'bar'?
| 
| Attribute style access would also fail in this instance -- how is
| this worked-around?

I'd be inclined to go for ('foo', 'bar'), though that makes all the
single occurence nodes into sequences too, a bit cumbersome:-(
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

alt.skunks      A newsgroup for enthusiasts of skunks and other mustelidae.



More information about the Python-list mailing list