Message180548
I agree that [0] should be treated as a visible error as it's easy to get wrong. It's certainly too late to change this to 0-based indexing and I think it's ok to keep it 1-based for XPath compatibility (or at least similarity) as that's what people will expect it to mimic. I came up with a similar fix for lxml, BTW.
Regarding the behaviour of negative indices, it's clearly broken and unexpected and "-1" is definitely not a valid XML tag name (as which it's currently interpreted). That's a change for Py3.4+ only though. Either disable negative indices completely and raise an exception at parse time or read "-X" as "last()-X". I would also be ok with the latter as it feels natural to support this in a Python context. But that's a new feature then, not a bug fix. And the fact that "last()-X" already exists tends to speak against it. It's more of an "if the intention is clear, why raise an exception" kind of thing. |
|
Date |
User |
Action |
Args |
2013-01-24 21:17:27 | scoder | set | recipients:
+ scoder, eli.bendersky, flox, python-dev, patrick.vrijlandt |
2013-01-24 21:17:27 | scoder | set | messageid: <1359062247.48.0.414734964308.issue12323@psf.upfronthosting.co.za> |
2013-01-24 21:17:27 | scoder | link | issue12323 messages |
2013-01-24 21:17:27 | scoder | create | |
|