On Mon, Sep 30, 2019 at 9:54 PM Dan Sommers
<[email protected]> wrote:
> I would have said the same thing, but the docs⁰ disagree: a
> PurePath represents the name of (or the path to) a file, but a
> Path represents the actual file.
>
>
> ⁰ https://docs.python.org/3/library/pathlib.html
I don't think it represents the actual file. If it did, equality would
be defined by samefile, NOT by the file name.
>>> from pathlib import Path
>>> import os
>>> open("file1", "w").close()
>>> os.link("file1", "file2")
>>> Path("file1") == Path("file2")
False
>>> Path("file1").samefile(Path("file2"))
True
>>> Path("file1") == Path("file1")
True
It still represents the path to the file, not the file itself, and if
you move something over it, it will see the new file.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list