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

Guido van Rossum guido at python.org
Mon Oct 8 20:53:11 CEST 2012


On Mon, Oct 8, 2012 at 11:49 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Tue, Oct 9, 2012 at 12:10 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>> On Mon, 8 Oct 2012 10:06:17 -0600
>> Andrew McNabb <amcnabb at mcnabbs.org> wrote:
>>>
>>> Since this really is a matter of personal taste, I'll end my
>>> participation in this discussion by voicing support for Nick Coghlan's
>>> suggestion of a `join` method, whether it's named `join` or `append` or
>>> something else.
>>
>> 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.
>
> 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.

It took me a while before I realized that 'abc'.join('def') already
has a meaning (returning 'dabceabcf'). But yes, this makes it a poor
choice for a Path method.

-- 
--Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list