Julien Palard <[email protected]> added the comment:
I checked conversation in #7951, tells about an ambiguity because it could be
an index from a sequence or a key for a dict, like {-1: "foo"}.
Here there is no such confusion.
Confusion *may* arrise from the fact that it's not composed of parts, but more
like it's already sliced, I mean it does NOT look like:
['/', 'home', 'mdk', 'clones', 'python']
It's more like:
['/home/mdk/clones/python', '/home/mdk/clones', '/home/mdk', '/home', '/']
In fact I'd say it behave more like a function call than a sequence access, I
read:
pathlib.Path.cwd().parents[1]
a bit like:
pathlib.Path.cwd().parents(go_down=1)
It may explain why negative indices or slices were initially not implemented:
It already looks like the result of a slice.
----------
nosy: +mdk
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue21041>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com