on 04.05.2006 16:18 Paul Moore said the following:
> On 5/4/06, Nick Coghlan <[EMAIL PROTECTED]> wrote:
>> My inclination was to have a PlatformPath subclass that accepted 'os', 'sep'
>> and 'extsep' keyword arguments to the constructor, and provided the
>> appropriate 'sep' and 'extsep' attributes (supplying 'os' would just be a
>> shortcut to avoid specifying the separators explicitly).
>>
>> That way the main class can avoid being complicated by the relatively rare
>> need to operate on another platform's paths, while still supporting the 
>> ability.
> 
> You ought to have predefined classes for the standard OSes. Expecting
> people to know the values for sep and extsep seems unhelpful.
> 

I assume that having subclasses (at least for the different os 
filesystem paths) is not necessary.
The sep and extsep that needs to be used is determined by the root of 
the path.

The root, I suppose, is set when constructing the path from a string.
The ambiguous cases are relative paths and `p = path()`.

(Also think of the proposed URL root which normally would mandate '/' as 
sep. Actually, the format depends on the 'scheme' part of the URL...)

On the output side ( `str(pathinstance)` ) the format is determined by 
the root.
At least if you ignore people who want to have 
C:/this/style/of/acceptable/windows/path

When constructing a relative path, I suggest creating a os dependent one 
(root==None) by default, even if you use::

   p = path('./unix/relative/style')

on Windows.
Daring people can later use::

   p.root = path.WINDOWSRELATIVE    # or
   p.root = path.UNIXRELATIVE

if they need to.

stefan

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to