PRE-PEP: new Path class

Gerrit Holl gerrit at
Thu Jan 8 21:32:56 CET 2004

John Roth wrote:
> I'm adding a thread for comments on Gerrit Holl's pre-pep, which
> can be found here:

I have updated a lot of things on the PEP in the past few days.
There are still larger and smaller open issues, though, besides the
usual 'I-can-change-my-mind-and-the-PEP-can-change-its-mind' things:

Quoting my own PEP:

Should path.__eq__ match path.samefile?

There are at least 2 possible ways to do it:

    - Normalize both operands by checking to which actual file they
      point (same (l)stat).
    - Try to find out whether the paths point to the same filesystem
      entry, without doing anything with the filesystem.

    - A path usually points to a certain place on the filesystem, and
      two paths with different string representations may point to the same place,
      which means they are essentially equal in usage.
    - We would have to choose a way, so we should first decide which is
      better and whether the difference is intuitive enough.
    - It makes hashing more difficult/impossible.
    - I don't know.
    - Bernard Herzog `points out
      that it would essentialy make path-objects non-hashable.
    - `James Orendorff's Path`_ inherits str.__eq__.
    - `Mike C. Fletcher's Path`_ chooses for the first variant.

Do we need to treat unicode filenames specially?

I have no idea.

    - An `explanation
      by Martin von Loewis.

- should os.tempnam be included?
- can normpath be coded using only os.path constants (if so, it's in the
  'platform-independent' class? (I think no)
- Should normalize be called normalized or not?
- Should stat be defined in the platform-dependent or -independent class?
- Should we include chdir and chroot? If so, where?
- Should rename return a new path object?
- Should renames be included?

And one meta-question:

Shall I submit this as an official PEP? Or shall I first fill in more
open issues and perhaps give the possibility to change "closed" issues?

See also:


202. If any one strike the body of a man higher in rank than he, he
shall receive sixty blows with an ox-whip in public.
          -- 1780 BC, Hammurabi, Code of Law
PrePEP: Builtin path type
Asperger's Syndrome - a personal approach:

More information about the Python-list mailing list