New submission from Joshua Cannon <[email protected]>:
I would expect the following to work:
```
>>> import pathlib
>>> pathlib.Path.cwd().parents[0:1]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "...\Python36\lib\pathlib.py", line 593, in __getitem__
if idx < 0 or idx >= len(self):
TypeError: '<' not supported between instances of 'slice' and 'int'
```
Since pathlib documents `parents` as a sequence-type, and slicing a sequence is
pretty standard behavior.
----------
components: Library (Lib)
messages: 331841
nosy: thejcannon
priority: normal
severity: normal
status: open
title: Parents objects in pathlib.Path don't support slices as __getitem__
arguments
type: enhancement
versions: Python 3.6
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35498>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com