Message180549
> 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. |
|
Date |
User |
Action |
Args |
2013-01-24 21:36:16 | eli.bendersky | set | recipients:
+ eli.bendersky, scoder, flox, python-dev, patrick.vrijlandt |
2013-01-24 21:36:16 | eli.bendersky | link | issue12323 messages |
2013-01-24 21:36:16 | eli.bendersky | create | |
|