This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients eli.bendersky, flox, patrick.vrijlandt, python-dev, scoder
Date 2013-01-24.21:17:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1359062247.48.0.414734964308.issue12323@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-01-24 21:17:27scodersetrecipients: + scoder, eli.bendersky, flox, python-dev, patrick.vrijlandt
2013-01-24 21:17:27scodersetmessageid: <1359062247.48.0.414734964308.issue12323@psf.upfronthosting.co.za>
2013-01-24 21:17:27scoderlinkissue12323 messages
2013-01-24 21:17:27scodercreate