[Python-ideas] PEP 428 - object-oriented filesystem paths

Antoine Pitrou solipsis at pitrou.net
Mon Oct 8 20:56:34 CEST 2012

On Tue, 9 Oct 2012 00:19:03 +0530
Nick Coghlan <ncoghlan at gmail.com> wrote:
> >
> > The join() method already exists in the current PEP, but it's less
> > convenient, synctatically, than either '[]' or '/'.
> Right. My objections boil down to:
> 1. The case has not been adequately made that a second way to do it is
> needed. Therefore, the initial version should just include the method
> API.

But you really want a short method name, otherwise it's better to have
a dedicated operator.  joinpath() definitely doesn't cut it, IMO.

(perhaps that's the same reason I am reluctant to use str.format() :-))

By the way, I also thought of using __call__, but for some reason I
think it tastes a bit bad ("too clever"?).

> 2. Using "join" as the method name is a bad idea for the same reason
> that using "+" as the operator syntax would be a bad idea: it can
> cause erroneous output instead of an exception if a string is passed
> where a Path object is expected.

Admitted, although I think the potential for confusion is smaller
than with "+" (I can't really articulate why, it's just that I fear
one much less than the other :-)).



Software development and contracting: http://pro.pitrou.net

More information about the Python-ideas mailing list