[issue34775] pathlib.PurePath division raises TypeError instead of returning NotImplemented
Berker Peksag
report at bugs.python.org
Sun Sep 23 03:58:01 EDT 2018
Berker Peksag <berker.peksag at gmail.com> added the comment:
Thanks for the report and for the PR. Could you give us a little bit more information about your use case? Couldn't you make the class you want to use implement the __fspath__ protocol?
import pathlib as p
class Spam:
def __fspath__(self):
return 'pathlib.py'
And we can use it like:
>>> p.Path('Lib') / Spam()
PosixPath('Lib/pathlib.py')
>>> (p.Path('Lib') / Spam()).exists()
True
(3.4 and 3.5 are in security-fix-only mode, so I removed them from the versions field.)
----------
nosy: +berker.peksag
stage: -> test needed
versions: -Python 3.4, Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34775>
_______________________________________
More information about the Python-bugs-list
mailing list