PRE-PEP: new Path class
Oren Tirosh
oren-py-l at hishome.net
Mon Jan 5 16:43:37 EST 2004
On Mon, Jan 05, 2004 at 10:06:59AM -0500, John Roth wrote:
> I'm adding a thread for comments on Gerrit Holl's pre-pep, which
> can be found here:
>
> http://tinyurl.com/2578q
>
> Frankly, I like the idea. It's about time that all of the file
> and directory stuff in the os module got objectified
> properly (or at least with some semblance of OO propriety!)
"Peroperly"? There is nothing particularly "proper" or "improper"
about objects or any other programming paradigm supported by Python.
Objectifying is not a goal in itself. I like the Path object because
the interface is easier to learn and use, not because it is
"objectified".
> 5) Should == operator be the same as os.path.samefile()?
>
> Why not...
No. Symbolic links are something you would sometimes want to treat as
distinct from the files they point to.
> walk is a nice function, but it should be redone to
> use the visitor pattern directly, with different method
> names for files, directories and whatever else a
> particular file system has in it's warped little mind.
I find a generator and a couple of elifs are much easier to read. No
need to define a class, pass context information to the methods of
that class, etc.
> 13) chdir, chmod, etc?
>
> No. This has nothing to do with pathname.
What's the difference between chmod and touch? They both affect the
file metadata in similar ways.
Oren
More information about the Python-list
mailing list