[Python-ideas] PEP 428: poll about the joining syntax

Nick Coghlan ncoghlan at gmail.com
Mon Oct 8 21:15:41 CEST 2012


On Tue, Oct 9, 2012 at 12:24 AM, Guido van Rossum <guido at python.org> wrote:
> I don't like any of those; I'd vote for another regular method, maybe
> p.pathjoin(q).

My own current preference is to take "p.joinpath(q)" straight from
path.py (https://github.com/jaraco/path.py/blob/master/path.py#L236).

My rationale for disliking all of the poll options (clarified during
the previous discussions, so I can summarise it better now):

"p[q]", "p + q", "p / q": A method API is desirable *anyway* (for
better integration with all the tools that deal with callables in
general), and no compelling justification has been provided for
offering two ways to do it (mere brevity when writing doesn't cut it,
when the result is something that is more cryptic when reading and
learning).

"p + q", "p.join(q)": passing strings where path objects are needed is
expected to be a common error mode, especially for people just
starting to use the new API. It is desirable that such errors produce
an exception rather than silently producing an incorrect string.

I don't *love* joinpath as a name, I just don't actively dislike it
the way I do the four presented options (and it has the virtue of the
path.py precedent).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list