Message180549
| Author |
eli.bendersky |
| Recipients |
eli.bendersky, flox, patrick.vrijlandt, python-dev, scoder |
| Date |
2013年01月24日.21:36:16 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<CAF-Rda-7x+JWmq3xUhMgm2F3ZxNe9Em7aBhtkq6sgybeBpOcbw@mail.gmail.com> |
| In-reply-to |
<1359062247.48.0.414734964308.issue12323@psf.upfronthosting.co.za> |
| 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.
>
Stefan,
IIUC, my recent commit (mirrored to the issue) is in accord with this
comment. Please correct me if I'm wrong. |
|