PRE-PEP: new Path class

Michael Chermside mcherm at mcherm.com
Thu Jan 8 14:15:09 CET 2004


> > Another Point:
> > Should Path be immutable like string?
> 
> I have though about this, too. It should certainly not be fully mutable,
> because if a path changes, it changes. But maybe we could have a
> .normalise_inplace() which mutates the Path? What consequences would
> this have for hashability?
> 
> I like paths to be hashable. so they probably should be immutable.

I agree... paths should be immutable.

Instead of .normalize_inplace() which changes the behavior of the
Path, how about .get_normalized_string() (please find a better name)
which allows access to the normalized version without mutating the
Path object? (Or perhaps it should be .get_normalized_Path()... I'm
not sure.)

-- Michael Chermside





More information about the Python-list mailing list