This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author berker.peksag
Recipients Roger Aiudi, berker.peksag
Date 2018-09-23.07:58:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537689481.08.0.956365154283.issue34775@psf.upfronthosting.co.za>
In-reply-to
Content
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.)
History
Date User Action Args
2018-09-23 07:58:01berker.peksagsetrecipients: + berker.peksag, Roger Aiudi
2018-09-23 07:58:01berker.peksagsetmessageid: <1537689481.08.0.956365154283.issue34775@psf.upfronthosting.co.za>
2018-09-23 07:58:01berker.peksaglinkissue34775 messages
2018-09-23 07:58:00berker.peksagcreate