Berker Peksag <berker.pek...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue34775>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to