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 serhiy.storchaka
Recipients lordmauve, pitrou, rbu, serhiy.storchaka
Date 2018-07-17.13:10:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1531833028.02.0.56676864532.issue33123@psf.upfronthosting.co.za>
In-reply-to
Content
It can be written as

    try:
        path.inlink()
    except FileNotFoundError:
        pass

If you want to save few lines of code, you can use contextlib.suppress().

    with suppress(FileNotFoundError): path.inlink()

I suggest to close this issue. It is better to keep the API simple and orthogonal. Adding an option in Path.unlink() will require adding this support of this option in third-part implementations of Path. In general, adding a single boolean parameter is not considered a good practice in Python.

A "strict" parameter in Path.resolve() does the different thing. In both cases Path.resolve() returns a value, and you can't implement strict=False by catching exception externally.
History
Date User Action Args
2018-07-17 13:10:28serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, lordmauve, rbu
2018-07-17 13:10:28serhiy.storchakasetmessageid: <1531833028.02.0.56676864532.issue33123@psf.upfronthosting.co.za>
2018-07-17 13:10:28serhiy.storchakalinkissue33123 messages
2018-07-17 13:10:27serhiy.storchakacreate