Re: [Python-Dev] os.path.diff(path1, path2) (and a first post)

2005-09-22 Thread Bob Ippolito
On Sep 22, 2005, at 8:58 PM, Trent Mick wrote: > [richard barran wrote] > >> So I have a question: do the previous mails mean that a relpath >> function might possibly be a usefull addition to os.path? >> > > Yes, it seems to have support. I'd like to throw in another late +1 here, I've written

Re: [Python-Dev] os.path.diff(path1, path2) (and a first post)

2005-09-22 Thread Trent Mick
[richard barran wrote] > So I have a question: do the previous mails mean that a relpath > function might possibly be a usefull addition to os.path? Yes, it seems to have support. > And if the answer to the previous question is "yes", then should I > submit a patch, or is someone else already

Re: [Python-Dev] os.path.diff(path1, path2) (and a first post)

2005-09-22 Thread richard barran
On Sat, 17 Sep 2005, John J Lee wrote: > > On Fri, 16 Sep 2005, Greg Ewing wrote: > > > Trent Mick wrote: > > > > > If this *does* get added (I'm +0) then let's call it "relpath" or > > > "relpathto" as in the various implementations out there: > > > > +1 on that, too. Preferably just "re

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-21 Thread Martin Blais
On 9/20/05, Greg Ewing <[EMAIL PROTECTED]> wrote: > Matthias Andreas Benkard wrote: > > * In a recent project, I had occasion to store pathnames of >picture files in a relational database. I wanted to store >the pathnames relative to a user-chosen "Pictures" >directory, so that it could

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-21 Thread Wolfgang Lipp
On Wed, 21 Sep 2005 02:55:56 +0200, Greg Ewing <[EMAIL PROTECTED]> wrote: > Both of these happen to involve pathnames that exist on > the currrently available file system, but I can easily > imagine cases where that would not be so. E.g. I might > be generating pathames to go into a tar file that

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-21 Thread Trent Mick
> > But this begs the question: What is relpath good for, anyway? > > A couple of use cases I've encountered: > Another one: - Build tools that work with paths alot can really improve their log readability if relative paths can be used to keep paths short rather than the common fallback of

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-20 Thread Greg Ewing
Matthias Andreas Benkard wrote: > But this begs the question: What is relpath good for, anyway? [Assuming you mean "invites", "prompts", etc. the question...:-)] A couple of use cases I've encountered: * Creating symbolic links. I'm traversing a directory hierarchy, and building a parallel h

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-20 Thread Matthias Andreas Benkard
Hi, > IMO, the relpath method should just work textually on > the pathnames. It's up to the user to ensure it makes > sense to do so, e.g. by resolving symlinks beforehand > if necessary. I guess so. Don't forget to mention this quirk in the docs, though :) > The alternative would be for relpath

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-19 Thread Greg Ewing
Delaney, Timothy (Tim) wrote: > > In addition, I would presume that relpath would just return the absolute > path if passed an absolute path as the second parameter. I don't think so. Wouldn't you expect the result of relpath("/usr/local/foo/bax/grump.c", "/usr/local/flump/grump.c") to be ".

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-19 Thread Delaney, Timothy (Tim)
Greg Ewing wrote: > Matthias Andreas Benkard wrote: > >> /home -> usr/home >> /usr >> /usr/home >> >> What does os.path.diff("/home/", "/usr/") yield? "../usr/", I would >> presume? But that's obviously wrong: > > IMO, the relpath method should just work textually on > the pathnames. It's up to

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-19 Thread Greg Ewing
Matthias Andreas Benkard wrote: > /home -> usr/home > /usr > /usr/home > > What does os.path.diff("/home/", "/usr/") yield? "../usr/", I would > presume? But that's obviously wrong: IMO, the relpath method should just work textually on the pathnames. It's up to the user to ensure it makes sense

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-19 Thread Matthias Andreas Benkard
Hi, > /home -> usr/home Sorry, I forgot to mention what I meant by this: /home is a symlink pointing to usr/home (that is, /usr/home). Bye, Matthias Matthias Andreas Benkard, Anarchokommunist und Pythonprogrammierer Per

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-19 Thread Matthias Andreas Benkard
Hi, > This function would take two paths: A and B and give > the relation between them. Here are a few of examples. > > os.path.diff("/A/C/D/", "/A/D/F/") > ==> "../../D/F" > > os.path.diff("/A/", "/A/B/C/") > ==> "B/C" > > os.path.diff("/A/B/C/", "/A/") > ==> "../.." I'm not sure whether s

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-17 Thread John J Lee
On Fri, 16 Sep 2005, Greg Ewing wrote: > Trent Mick wrote: > > > If this *does* get added (I'm +0) then let's call it "relpath" or > > "relpathto" as in the various implementations out there: > > +1 on that, too. Preferably just "relpath". [...] +1 on adding this function, and on "relpath" as t

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-15 Thread Greg Ewing
Trent Mick wrote: > If this *does* get added (I'm +0) then let's call it "relpath" or > "relpathto" as in the various implementations out there: +1 on that, too. Preferably just "relpath". -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury,

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-15 Thread Trent Mick
[Greg Ewing wrote] > Nathan Bullock wrote: > > I find that I quite often want a > > function that will give me a relative path from path A > > to path B. I have created such a function, but it > > would be nice if it was in the standard library. > > +1 from me. It's a fairly common thing to want t

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-14 Thread Greg Ewing
Nathan Bullock wrote: > I find that I quite often want a > function that will give me a relative path from path A > to path B. I have created such a function, but it > would be nice if it was in the standard library. +1 from me. It's a fairly common thing to want to do. Greg _

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-14 Thread Martin Blais
On 9/12/05, Nathan Bullock <[EMAIL PROTECTED]> wrote: > Just wondering if a function such as this has ever > been considered? I find that I quite often want a > function that will give me a relative path from path A > to path B. I have created such a function, but it > would be nice if it was in th

Re: [Python-Dev] os.path.diff(path1, path2)

2005-09-13 Thread Trent Mick
[Nathan Bullock wrote] > Just wondering if a function such as this has ever > been considered? I find that I quite often want a > function that will give me a relative path from path A > to path B. I have created such a function, but it > would be nice if it was in the standard library. > > This f

[Python-Dev] os.path.diff(path1, path2)

2005-09-13 Thread Nathan Bullock
Just wondering if a function such as this has ever been considered? I find that I quite often want a function that will give me a relative path from path A to path B. I have created such a function, but it would be nice if it was in the standard library. This function would take two paths: A and B