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

Eric Snow ericsnowcurrently at gmail.com
Thu Oct 11 04:34:36 CEST 2012


On Oct 8, 2012 5:35 PM, "Eric Snow" <ericsnowcurrently at gmail.com> wrote:
>
> On Mon, Oct 8, 2012 at 12:47 PM, Antoine Pitrou <solipsis at pitrou.net>
wrote:
> > - `p[q]` joins path q to path p
> -1
> > - `p + q` joins path q to path p
> -1
> > - `p / q` joins path q to path p
> -1
> > - `p.join(q)` joins path q to path p
> +1 (with a different name)
>
> I've found Nick's argument against operators-from-day-1 to be
> convincing, as well as his argument against join() or any other name
> already provided by string/sequence APIs.

Changing my vote:

p[q]                 -1
p + q               -1
p / q               +0
p.pathjoin()   +1

A method is essential, regardless of the color the bikeshed ends up.  As
far as operators go, / is the only option here that doesn't conflict with
string/collection APIs.  The alternative has an adverse impact on
subclassing and on future design choices on the path API.  This goes for
the method name too.

-eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121010/f1e74576/attachment.html>


More information about the Python-ideas mailing list