[path-PEP] Path inherits from basestring again

Tony Meyer t-meyer at ihug.co.nz
Thu Jul 28 22:52:55 EDT 2005


[using __div__ to mean join]

> I'm not too happy with it, too, but do we have alternatives? 
> As paths are strings, we can hardly override the '+' operator,
> so there's not much operators left.
> 
> Of course, one can use joinwith() if he doesn't like '/'.

My argument is that the alternative is to not provide an operator for this,
and to force people to use the appropriate join function (joinwith, I
gather).  Not everything needs to have an operator! (In Python, at least
<wink>).

Consider the 'discussion' regarding '@' and decorators.  It's pretty clear
that the Python community really isn't in favour of overloading characters
with a lot of different meanings, and would much prefer being explicit
(explicit is better than implicit, and all that).  (Guido disagreed in this
particular case, of course, but I believe that is an exception).

I don't speak for python-dev or know for sure, but I suspect that the PEP
would have a greater chance of acceptance (the goal, I presume) if this
__div__ hackery wasn't in it.

=Tony.Meyer




More information about the Python-list mailing list