pathlib

Barry Scott barry at barrys-emacs.org
Mon Sep 30 15:56:06 EDT 2019



> On 30 Sep 2019, at 16:49, Dan Sommers <2QdxY4RzWzUUiLuE at potatochowder.com> wrote:
> 
> That's an interesting question.  If you phrase the question like
> that, then you're right:  expecting a string to track the content
> of a file is a mistake.



> 
> In the totality of a Path object that claims to represent paths
> to files,

It represents string that *should* in most cases work in the APIs
that work on files. Not the same idea.


> 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).

"the object" did track the changes its just that "the object" is not
the Path object, it's in the operating system and/or the file system.
For the rename it's the directory that the name is recorded in.

There was an interest talk at this years PYCON UK about the
the errors that people new to python make. Misunderstand syntax
is about 1/3 of the problems, but 2/3 was having the wrong model.

This discussion seems to fall into the "wrong model" world that
leads to a expectation failure.

Have we moved on to how we can improve the situation?

Barry





More information about the Python-list mailing list