Differences between revisions 3 and 4
Revision 3 as of 2005-07-29 16:51:10
Size: 990
Editor: ORR6147
Comment:
Revision 4 as of 2005-07-29 17:28:04
Size: 1033
Editor: NickCoghlan
Comment: Clarify what the property/method distinction is based on
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
2. Properties are the interface for immutable attributes of a Path. For example, a Path's basename will be the same regardless of data on the local filesystem. 2. Properties are the interface for actual attributes of a Path. For example, a Path's basename will be the same regardless of data on the local filesystem.
Line 15: Line 15:
3. Methods are the interface for mutable attributes, for example, the last-modified-time. 3. Methods are the interface for attributes of whatever the Path represents, for example, the last-modified-time or contents of a file.

Path class Pre-Pre-PEP

Implementation(s)

Reinhold has modified Jason Orendorff's original path.py to fit discussions in python-dev and comp.lang.python and has placed it in Python CVS under nondist/sandbox/path.

Other implementations to look at include the original, path.py and some things that others have mentioned on c.l.p. and python-dev.

Design Principles

1. A Path should be a drop-in replacement for a str or unicode as much as possible.

2. Properties are the interface for actual attributes of a Path. For example, a Path's basename will be the same regardless of data on the local filesystem.

3. Methods are the interface for attributes of whatever the Path represents, for example, the last-modified-time or contents of a file.

4. Should be subclassable so third parties can offer richer subclasses. Use self.__class__() instead of Path() in method bodies. Alternate constructors like Path.cwd() should be a class methods rather than static methods. (MikeOrr)

PathClass (last edited 2009-09-13 06:07:15 by 216)

Unable to edit the page? See the FrontPage for instructions.