pathlib

Chris Angelico rosuav at gmail.com
Mon Sep 30 12:51:04 EDT 2019


On Tue, Oct 1, 2019 at 1:51 AM Dan Sommers
<2QdxY4RzWzUUiLuE at potatochowder.com> wrote:
> In the totality of a Path object that claims to represent paths
> to files, including the arguably troublesome read_bytes and
> write_bytes methods, and a rename method, however, it's not
> unreasonable expect the object to track *itself* when I use *its*
> own rename method (backwards compatibility restraints
> notwithstanding).
>

What if the path is formed from another path, and the other one
renames? Create a Path("/path/to/some/dir") and then file = dir /
"some_file", then rename the directory - should the file insta-reflect
that? Even if you DO have them link magically so that it updates, you
would then have to contend with the fact that, when you rename
directories, you often *want* to slide onto the new dir - that's one
way to replace an entire set of files atomically (which also involves
open_at).

ChrisA



More information about the Python-list mailing list