Re: [Python-Dev] Alternative path suggestion

2006-05-09 Thread Martin Blais
Unfortunately, I have no time to read all the details on this interesting thread (I wish), but I also have an alternative path implementation, feel free to scavenge anything from it you might find useful. I put it here: http://furius.ca/pubcode/pub/conf/common/lib/python/ipath.py.html I think

Re: [Python-Dev] Alternative path suggestion

2006-05-07 Thread Noam Raphael
Hello all again! Thanks to Mike's suggestion, I now opened a new wiki page, AlternativePathDiscussion, in http://wiki.python.org/moin/AlternativePathDiscussion The idea is to organize the discussion by dividing it into multiple sections, and seeing what is agreed and what should be further

Re: [Python-Dev] Alternative path suggestion

2006-05-06 Thread Mike Orr
On 5/5/06, Nick Coghlan [EMAIL PROTECTED] wrote: Mike Orr wrote: On 5/4/06, Paul Moore [EMAIL PROTECTED] wrote: (But all the current proposals seem to build on os.path, so maybe I should assume otherwise, that os.path will remain indefinitely...) They build on os.path because that's

Re: [Python-Dev] Alternative path suggestion

2006-05-06 Thread Greg Ewing
Nick Coghlan wrote: So I suggest splitting the internal data into 'path elements separated by os.sep', 'name elements separated by os.extsep' What bothers me about that is that in many systems there isn't any formal notion of an extension, just a convention used by some applications. Just

Re: [Python-Dev] Alternative path suggestion

2006-05-06 Thread Greg Ewing
Mike Orr wrote: How do you do slicing and joining? If Path subclasses object, it could be done there like in the first example. But if Path subclasses string, Er, hang on, I thought the idea was that it wouldn't subclass either tuple *or* str, but would be a new class all of its own. That

Re: [Python-Dev] Alternative path suggestion

2006-05-06 Thread Giovanni Bajo
Greg Ewing [EMAIL PROTECTED] wrote: So I suggest splitting the internal data into 'path elements separated by os.sep', 'name elements separated by os.extsep' What bothers me about that is that in many systems there isn't any formal notion of an extension, just a convention used by some

Re: [Python-Dev] Alternative path suggestion

2006-05-06 Thread Nick Coghlan
Greg Ewing wrote: Nick Coghlan wrote: So I suggest splitting the internal data into 'path elements separated by os.sep', 'name elements separated by os.extsep' What bothers me about that is that in many systems there isn't any formal notion of an extension, just a convention used by

Re: [Python-Dev] Alternative path suggestion

2006-05-06 Thread Mike Orr
On 5/6/06, Nick Coghlan [EMAIL PROTECTED] wrote: Greg Ewing wrote: Nick Coghlan wrote: So I suggest splitting the internal data into 'path elements separated by os.sep', 'name elements separated by os.extsep' What bothers me about that is that in many systems there isn't any formal

Re: [Python-Dev] Alternative path suggestion

2006-05-06 Thread Edward Loper
On May 6, 2006, at 2:40 AM, Nick Coghlan wrote: Remember, the idea with portable path information is to *never* store os.sep and os.extsep anywhere in the internal data - those should only be added when needed to produce strings to pass to OS-specific functions or to display to users.

Re: [Python-Dev] Alternative path suggestion

2006-05-06 Thread Oleg Broytmann
On Sat, May 06, 2006 at 12:11:59PM -0400, Edward Loper wrote: If one of the path segments contained a path-splitting character, should it automatically get quoted? (Is that even possible on all platforms?) E.g., what would the following give me on windows? str(Path('a', 'b\\c'))

Re: [Python-Dev] Alternative path suggestion

2006-05-06 Thread Greg Ewing
Edward Loper wrote: If one of the path segments contained a path-splitting character, should it automatically get quoted? No, an exception should be raised if you try to construct a Path object containing such a name. No such object could exist in the file system, so there's no point in

Re: [Python-Dev] Alternative path suggestion

2006-05-04 Thread Fredrik Lundh
Noam Raphael wrote: You can find the implementation at http://wiki.python.org/moin/AlternativePathModule?action=raw (By the way, is there some code wiki available? It can simply be a public svn repository. I think it will be useful for those things.) pastebin is quite popular:

Re: [Python-Dev] Alternative path suggestion

2006-05-04 Thread Nick Coghlan
Stefan Rank wrote: I suggest storing the first element separately from the rest of the path. The reason for suggesting this is that you use 'os.sep' to separate elements in the normal path, but *not* to separate the first element from the rest. I want to add that people might want to

Re: [Python-Dev] Alternative path suggestion

2006-05-04 Thread Paul Moore
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

Re: [Python-Dev] Alternative path suggestion

2006-05-04 Thread Stefan Rank
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

Re: [Python-Dev] Alternative path suggestion

2006-05-04 Thread Guido van Rossum
On 5/4/06, Nick Coghlan [EMAIL PROTECTED] wrote: Guido has indicated strong dissatisfaction with the idea of subclassing str/unicode with respect to PEP 355. That's not my only problem with that PEP; I'm not at all convinced that an object is a better solution than a module for this particular

Re: [Python-Dev] Alternative path suggestion

2006-05-04 Thread Gustavo Niemeyer
The biggest conceptual change is that my path object is a subclass of ''tuple'', not a subclass of str. For example, Using tuples is a nice idea! Object paths using tuples is a somewhat common concept. I don't see an immediate reason to be a *subclass* of tuple, though, as opposed to using it

Re: [Python-Dev] Alternative path suggestion

2006-05-04 Thread Gustavo Niemeyer
You ought to have predefined classes for the standard OSes. Expecting people to know the values for sep and extsep seems unhelpful. (...) Why not something as simple as having path.sep == None meaning the default for the platform, and a defined value for otherwise? -- Gustavo Niemeyer