[Python-3000] Mini Path object

Ron Adam rrr at ronadam.com
Mon Nov 6 02:35:16 CET 2006


Mike Orr wrote:

> The multi-argument constructor is a replacement for joining paths.
> (The PEP says .joinpath was "problematic" without saying why.)    This
> could theoretically go either way, doing either the same thing as
> os.path.join, getting a little smarter, or doing "safe" joins by
> disallowing "/" embedded in string arguments.

Some of this may be due to platform dependency.

Maybe adding some equivalent mechanism like unicode.encode() and str.decode() to 
path objects to enable easier use of foreign or different types of paths in some 
situations would be good?

In this case instead of a string encoding, it would be a path os encoding.

    Path("ABC").encode('windows') =>  a windows path string from a path object.

    Path().decode('ABC', 'windows') =>  a platform dependant path object

Don't take these examples too literally, I'm just pointing out a concept that 
might be useful where paths from differing platforms may touch each other.

You would probably want to use a different spelling for these so they don't get 
confused with string encodings.

Could paths be handled with a string encoding?  Just a thought.

Cheers,
   Ron












More information about the Python-3000 mailing list