random832 is right, XML elements are ordered. But this is a tangent. HTML attributes, JSON objects, and plenty of other types are _not_ ordered. So, even if your example is bad, you can trivially sub it into an equivalent example that's good.
________________________________ From: Don Spaulding
To: random832@fastmail.us Cc: python-ideas Sent: Wednesday, May 15, 2013 1:36 PM Subject: Re: [Python-ideas] Let's be more orderly! On Wed, May 15, 2013 at 3:01 PM,
wrote: Hang on, what?
Now, maybe that's true of your _particular_ XML spec. And this certainly seems symptomatic of a larger problem (e.g. firing off an event as soon as the action tag closes, rather than parsing the whole document). But XML elements are _not_ unordered.
Hmm, when I ran across this particular problem, I recall seeing somewhere that the preservation of element order in the spec is undefined. And indeed it appears that while attributes are called explicitly as not having significant order, the spec doesn't actually weigh in on element order one way or another. However, regardless of what's in the spec, it would seem that everyone just assumes element order to be significant anyway, so it doesn't really matter.
http://lists.xml.org/archives/xml-dev/200101/msg00841.html
On Wed, May 15, 2013, at 15:35, Don Spaulding wrote:
Twice now I've encountered poorly-written web services that have choked on something like:
<request> <action>modifyStuff</action> <user>user_123456</user> </request>
...with an error to the effect of "Cannot modifyStuff without specifying user credentials". So someone else has built a system around an XML parser that doesn't know that sibling elements aren't guaranteed to appear in any particular order.
-- Random832 (top-posted because my reply and your message aren't guaranteed to appear in any particular order.)
OrderedDict(I='see', what='you', did='there') OrderedDict([('did', 'there'), ('I', 'see'), ('what', 'you')])
Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas