mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Issue #19775: Add a samefile() method to pathlib Path objects.
Initial patch by Vajrasky Kok.
This commit is contained in:
parent
38acd4c028
commit
43e3d9409d
4 changed files with 53 additions and 0 deletions
|
@ -884,6 +884,25 @@ call fails (for example because the path doesn't exist):
|
|||
Remove this directory. The directory must be empty.
|
||||
|
||||
|
||||
.. method:: Path.samefile(other_path)
|
||||
|
||||
Return whether this path points to the same file as *other_path*, which
|
||||
can be either a Path object, or a string. The semantics are similar
|
||||
to :func:`os.path.samefile` and :func:`os.path.samestat`.
|
||||
|
||||
An :exc:`OSError` can be raised if either file cannot be accessed for some
|
||||
reason.
|
||||
|
||||
>>> p = Path('spam')
|
||||
>>> q = Path('eggs')
|
||||
>>> p.samefile(q)
|
||||
False
|
||||
>>> p.samefile('spam')
|
||||
True
|
||||
|
||||
.. versionadded:: 3.5
|
||||
|
||||
|
||||
.. method:: Path.symlink_to(target, target_is_directory=False)
|
||||
|
||||
Make this path a symbolic link to *target*. Under Windows,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue