[issue35498] Parents objects in pathlib.Path don't support slices as __getitem__ arguments

2020-11-23 Thread Paul Ganssle
Paul Ganssle added the comment: New changeset 79d2e62c008446fbbc6f264bb8a30e2d38b6ff58 by Yaroslav Pankovych in branch 'master': Added support for negative indexes to PurePath.parents (GH-21799) https://github.com/python/cpython/commit/79d2e62c008446fbbc6f264bb8a30e2d38b6ff58 --

[issue35498] Parents objects in pathlib.Path don't support slices as __getitem__ arguments

2020-11-20 Thread Paul Ganssle
Change by Paul Ganssle : -- dependencies: -pathlib.PurePath.parents rejects negative indexes resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue35498] Parents objects in pathlib.Path don't support slices as __getitem__ arguments

2020-11-20 Thread Paul Ganssle
Paul Ganssle added the comment: New changeset 452058448335b39c784af9a047f9c4a1767c0b00 by Joshua Cannon in branch 'master': bpo-35498: Added slice support to PathLib parents attribute. (GH-11165) https://github.com/python/cpython/commit/452058448335b39c784af9a047f9c4a1767c0b00 --

[issue35498] Parents objects in pathlib.Path don't support slices as __getitem__ arguments

2020-11-19 Thread Paul Ganssle
Paul Ganssle added the comment: One question I would have about this is that `.parents` is a lazily-calculated sequence, not a list or a tuple, so it's not immediately obvious what the return type of a slice would be. I don't think it makes sense to return, e.g. a `_PathParents` object with

[issue35498] Parents objects in pathlib.Path don't support slices as __getitem__ arguments

2019-09-13 Thread Joshua Cannon
Joshua Cannon added the comment: Pretty much the same reason you would want to slice any other sequence. You want some range of values. top_most_3_dirs = myPath.parents[-3:] grandparents_and_beyond = myPath.parents[1:] The same goes for negative indexes. --

[issue35498] Parents objects in pathlib.Path don't support slices as __getitem__ arguments

2019-09-13 Thread Julien Palard
Julien Palard added the comment: Just commented on the related issue: https://bugs.python.org/issue21041#msg352281 My question is: Why would you need to slice parents? parents already looks like the result of some slice. -- nosy: +mdk ___

[issue35498] Parents objects in pathlib.Path don't support slices as __getitem__ arguments

2018-12-17 Thread Brett Cannon
Change by Brett Cannon : -- nosy: +brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35498] Parents objects in pathlib.Path don't support slices as __getitem__ arguments

2018-12-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue21041. First than add support for slices, we should make a decision about negative indices. In any case this is a new feature, which can be only added in the future 3.8 release. -- dependencies: +pathlib.PurePath.parents rejects

[issue35498] Parents objects in pathlib.Path don't support slices as __getitem__ arguments

2018-12-14 Thread Joshua Cannon
Joshua Cannon added the comment: If it is deemed a bug which needs to be fixed, I've gone ahead and attached the PR to fix it. CLA signage is pending approval at the company I work for, with most people out for the holidays (so it might be a day or two turnaround). --

[issue35498] Parents objects in pathlib.Path don't support slices as __getitem__ arguments

2018-12-14 Thread Joshua Cannon
Change by Joshua Cannon : -- keywords: +patch pull_requests: +10401 stage: -> patch review ___ Python tracker ___ ___

[issue35498] Parents objects in pathlib.Path don't support slices as __getitem__ arguments

2018-12-14 Thread Joshua Cannon
New submission from Joshua Cannon : I would expect the following to work: ``` >>> import pathlib >>> pathlib.Path.cwd().parents[0:1] Traceback (most recent call last): File "", line 1, in File "...\Python36\lib\pathlib.py", line 593, in __getitem__ if idx < 0 or idx >= len(self):