[Python-ideas] Define __getitem__ for PurePath
Riley Banks
waultah at gmail.com
Sun Apr 12 09:57:25 CEST 2015
Greetings.
I think it'd be nice to have the ability to subscript/slice instances of
pathlib.PurePath and its subclasses e.g.
path = Path()
assert path[n:m:k] == type(path)(*path.parts[n:m:k])
Maybe it's worth adding some check with custom exception thrown in case of
invalid index/slice. What do you think? I'll open new issue and submit a
patch if you approve of this...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150412/4c967aa3/attachment-0001.html>
More information about the Python-ideas
mailing list