Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: path module

Reply
Thread Tools

Re: path module

 
 
holger krekel
Guest
Posts: n/a
 
      07-08-2003
Ian Bicking wrote:
> I think Jason Orendorff's path module is really nice:
> http://www.jorendorff.com/articles/python/path/


Yes, looks nice.

> Beats the hell out of os.path, which is an ugly thing indeed. The OO
> interface means you could use the interface nicely to implement other
> things, like URLs. The problem? It's just some module. The various os
> functions (of which path replaces quite a few) have become idiomatic to
> me, and I'm sure others as well. I find myself reluctant to use it in
> code that's not essentially private, because it's changing something
> small and seemingly trivial, and people won't be familiar with it.
>
> The solution? It should be a builtin! Or, if not a builtin, included
> in the os module. But I actually like the idea of it being a builtin --
> if open is a builtin, path stands right up there too. It would get rid
> of 90% of the use of the os module.
>
> Thoughts? Reactions?


I agree that something like Jason Orendorff's path module should go into
the standard library. I've coded a similar module and i think that
a discussion about certain design decisions would probably improve our
approaches.

For example Jason lets the "path" object inherit from "str" (or unicode)
but i think it's better to provide a "__str__" method so that you can say

str(pathinstance).endswith('.py')

and *not* base the path object on str/unicode.

unicode(pathinstance)

would just fail if your platform doesn't support this. First, i tried
the inheritance approach, btw, but it is ambigous (e.g. for the
join-method (str.join and os.path.join).

Also, my module provides most of the os.path.* methods as "filters" so
you can say

dirs = filter(isdir, list_obj_pathobjects)
fnames = filter(AND(nolink, isfile), list_obj_pathobjects)

in addition to

pathobject.isfile()
etc.

Recently, i also did some experimentation with "virtual-fs" features so
that you can transparently access http/ftp/svn files/directories. I even
got that to work with "<tab>-completion" but that was quite a hack

I am pretty sure that virtual-fs-like-extensibility would be a big
"selling" point and would motivate the use of such a module and
finally the inclusion into the stdlib. Of course, the local-fs should
be the convenient case but it shouldn't be hard to use the same methods
for accessing remote "repositories".

Anyway, i am all for going in this direction and would probably
like to participate in such a development and design effort.

cheers,

holger

 
Reply With Quote
 
 
 
 
Just
Guest
Posts: n/a
 
      07-08-2003
In article <(E-Mail Removed)>,
holger krekel <(E-Mail Removed)> wrote:

> I am pretty sure that virtual-fs-like-extensibility would be a big
> "selling" point and would motivate the use of such a module and
> finally the inclusion into the stdlib. Of course, the local-fs should
> be the convenient case but it shouldn't be hard to use the same methods
> for accessing remote "repositories".


Excellent point!

Just
 
Reply With Quote
 
 
 
 
John J. Lee
Guest
Posts: n/a
 
      07-08-2003
holger krekel <(E-Mail Removed)> writes:
[...]
> Recently, i also did some experimentation with "virtual-fs" features so
> that you can transparently access http/ftp/svn files/directories. I even
> got that to work with "<tab>-completion" but that was quite a hack

[...]

Note that this overlaps a bit with urllib and urllib2. Just something
that would need thinking about.


John
 
Reply With Quote
 
Paul Moore
Guest
Posts: n/a
 
      07-14-2003
holger krekel <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> I agree that something like Jason Orendorff's path module should go into
> the standard library. I've coded a similar module and i think that
> a discussion about certain design decisions would probably improve our
> approaches.


Is it available anywhere? It would be nice to be able to try both, for comparison.

Paul.
 
Reply With Quote
 
holger krekel
Guest
Posts: n/a
 
      07-15-2003
Paul Moore wrote:
> holger krekel <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> > I agree that something like Jason Orendorff's path module should go into
> > the standard library. I've coded a similar module and i think that
> > a discussion about certain design decisions would probably improve our
> > approaches.

>
> Is it available anywhere? It would be nice to be able to try both, for comparison.


sorry, not right now. I'll try to make a release soonish.

holger

 
Reply With Quote
 
Paolo Invernizzi
Guest
Posts: n/a
 
      07-15-2003
holger krekel wrote:

> Paul Moore wrote:
>
>>holger krekel <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
>>
>>>I agree that something like Jason Orendorff's path module should go into
>>>the standard library. I've coded a similar module and i think that
>>>a discussion about certain design decisions would probably improve our
>>>approaches.

>>
>>Is it available anywhere? It would be nice to be able to try both, for comparison.

>
>
> sorry, not right now. I'll try to make a release soonish.
>
> holger
>


I cannot access the path.py module from
http://www.jorendorff.com/articles/python/path/

Someone can be so kind to email it to me?

Thanks in advance!

---
Paolo Invernizzi
paoloinvernizzi at dmsware.com



 
Reply With Quote
 
Florian Schulze
Guest
Posts: n/a
 
      07-15-2003
Try google with "cache:http://..." this worked for me.

Florian

On Tue, 15 Jul 2003 10:45:45 +0200, Paolo Invernizzi
<(E-Mail Removed)> wrote:

> holger krekel wrote:
>
>> Paul Moore wrote:
>>
>>> holger krekel <(E-Mail Removed)> wrote in message
>>> news:<(E-Mail Removed)>...
>>>
>>>> I agree that something like Jason Orendorff's path module should go
>>>> into
>>>> the standard library. I've coded a similar module and i think that
>>>> a discussion about certain design decisions would probably improve our
>>>> approaches.
>>>
>>> Is it available anywhere? It would be nice to be able to try both, for
>>> comparison.

>>
>>
>> sorry, not right now. I'll try to make a release soonish.
>>
>> holger
>>

>
> I cannot access the path.py module from
> http://www.jorendorff.com/articles/python/path/
>
> Someone can be so kind to email it to me?
>
> Thanks in advance!
>
> ---
> Paolo Invernizzi
> paoloinvernizzi at dmsware.com
>
>
>
>




--
Florian Schulze
 
Reply With Quote
 
Paolo Invernizzi
Guest
Posts: n/a
 
      07-15-2003
Florian Schulze wrote:

> Try google with "cache:http://..." this worked for me.


Done.

Thanks for the advice.

---
Paolo




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: module docstring, documentation,anything? please note is the module type/object NOT some module Maric Michaud Python 0 06-24-2006 12:42 PM
Path as a dictionary tree key? (was Re: PEP on path module forstandard library) Ron Adam Python 3 08-02-2005 04:27 AM
Server.MapPath() croaking with "failed to map path", but path is legal awbacker@gmail.com ASP .Net 0 05-12-2005 10:50 PM
Bizzare: Invalid path to Access mdb, path is good Keith-Earl ASP .Net 1 05-03-2004 03:25 PM
Tomcat returning 404 error when using additional path (/servlet/myServlet/extra/path/info) Mupota Muchelemba Java 1 02-04-2004 12:43 AM



Advertisments