[path-PEP] Path inherits from basestring again

Stefan Rank stefan.rank at ofai.at
Mon Jul 25 05:03:53 EDT 2005


on 25.07.2005 10:44 Michael Hoffman said the following:
> Reinhold Birkenfeld wrote:
>>Tony Meyer wrote:
>>>Do people really like using __div__ to mean join?
>>Of course, one can use joinwith() if he doesn't like '/'.
> Personally, I'm -0 on __div__, but I suppose if anyone here claimed to 
> have used in the past, rather than it just being some novelty that might 
> be a good idea, that would be good enough for keeping it.

I, herewith, claim to have used it in the past.

But I am indifferent as to if its needed, it just looks natural to me.

What I use quite often is::

   path(__file__).dirname() / "somesiblingfileiknowisthere"

you do not have to think about trailing slashes or absolute vs. 
relative. and its much better than::

   from os.path import *
   join(dirname(__file__), "somesiblingfileiknowisthere")

__div__ is actually very convenient to "build" / "a" / "very" / "very" / 
"long" / "path" (of course assuming the parts are strings not known 
initially...)




More information about the Python-list mailing list