diff options
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r-- | Lib/pathlib.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 48b7031..428de39 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -964,6 +964,17 @@ class Path(PurePath): """ return cls(os.getcwd()) + def samefile(self, other_path): + """Return whether `other_file` is the same or not as this file. + (as returned by os.path.samefile(file, other_file)). + """ + st = self.stat() + try: + other_st = other_path.stat() + except AttributeError: + other_st = os.stat(other_path) + return os.path.samestat(st, other_st) + def iterdir(self): """Iterate over the files in this directory. Does not yield any result for the special paths '.' and '..'. |