PRE-PEP: new Path class

Gerrit Holl gerrit at nl.linux.org
Thu Jan 8 15:32:56 EST 2004


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

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.

pro
    - 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.
con
    - 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.
conclusion
    - I don't know.
links
    - Bernard Herzog `points out
      <http://mail.python.org/pipermail/python-list/2004-January/201857.html>`__
      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.

links
    - An `explanation
      <http://mail.python.org/pipermail/python-list/2004-January/201418.html>`__
      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: http://people.nl.linux.org/~gerrit/creaties/path/pep-xxxx.html

yours,
Gerrit.

-- 
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
    http://people.nl.linux.org/~gerrit/creaties/path/pep-xxxx.html
Asperger's Syndrome - a personal approach:
	http://people.nl.linux.org/~gerrit/english/




More information about the Python-list mailing list