[Python-Dev] When should pathlib stop being provisional?

Brett Cannon brett at python.org
Tue Apr 5 19:47:32 EDT 2016


On Tue, 5 Apr 2016 at 15:55 Guido van Rossum <guido at python.org> wrote:

> It's been provisional since 3.4. I think if it is still there in 3.6.0
> it should be considered no longer provisional. But this may indeed be
> a test case for the ultimate fate of provisional modules -- should we
> remove it?
>
> I have to admit I got tired of the discussions and muted them all.
>

:) I figured. I was close myself until I decided to be the "not inheriting
from str is a sane decision" camp because people weren't understanding
where the design decision probably came from, hence
http://www.snarky.ca/why-pathlib-path-doesn-t-inherit-from-str .


> Personally I am not worried about the light use (I always expected it
> would take a long time to get adoption)


Ditto. My expectation/hope is that once we stop having it be provisional
and we start using it in the stdlib then usage will pick up, especially if
libraries pick up the `getattr(path, 'path', path)` idiom as an easy
transition technique until they decide to drop support for str-based paths.
The main motivation of this email is actually to have newcomers to the
sprints at PyCon US sprint on adding support for pathlib (after we add
"path-like object" to the glossary to say something like "a `str` object or
an object that has a `path` attribute that itself is a `str`").


> but I am worried about the
> hostility towards the module. My last/only comment in the discussion
> was about there possibly being a dichotomy between people who use
> Python for scripting and those who use it to write more substantial
> programs (I'm trying not to judge one group more important than
> another -- I'm just observing there seem to be these two groups). But
> I didn't stick around long enough to watch for responses to this idea.
>

Nope, no response (as Alexander pointed out).


>
> Would making it inherit from str cause most hostility to disappear?
>

Probably. Most people were upset with pathlib because they couldn't use it
immediately with all of the third-party libraries out there on top of the
stdlib because adoption has been so low. Now if we make a concerted effort
to accept pathlib in the stdlib then this may be the kick in the pants that
it takes to start getting people to accept it externally and the transition
band-aid of inheriting from str may not be needed.

To me it seems to basically be a question of whether people can be patient
during a transition and embrace pathlib over time or if they will simply
refuse to add support in libraries and refuse to use `getattr(path, 'path',
path)` or `str(path)` in the mean time. Personally, if we can wait out the
Python 3 transition I have no issue waiting on a transition like this that
has no backward-compatibility issues and has a one-liner solution for
adding shallow support (and thus is ripe for quick patches to projects).

After the whole str thing the only other major topic was coming up with
some easier way to produce pathlib.Path instances (e.g. the p-string
suggestion). Nothing really came of those discussions that seemed concrete
and reach consensus, though (I think that may have been where your
scripting/substantial programming comment came from).


> I'm sure there was a discussion about this when PEP 428 was originally
> proposed, and I recall I was strongly in the camp of "it should not
> inherit from str", but unfortunately the PEP has no mention of this
> discussion or even the stated reason.
>

https://www.python.org/dev/peps/pep-0428/#no-confusion-with-builtins is the
best you get in the PEP.

-Brett


>
> --Guido
>
>
> On Tue, Apr 5, 2016 at 3:41 PM, Brett Cannon <brett at python.org> wrote:
> > After a rather extensive discussion on python-ideas about
> pathlib.PurePath
> > not inheriting from str, another point that came up was that the use of
> > pathlib has been rather light. Unfortunately even the stdlib doesn't
> really
> > use pathlib because it's currently marked as provisional (or at least
> that's
> > why I haven't tried to use it where possible in importlib).
> >
> > Do we have a plan of what is required to remove the provisional label
> from
> > pathlib?
> >
> > _______________________________________________
> > Python-Dev mailing list
> > Python-Dev at python.org
> > https://mail.python.org/mailman/listinfo/python-dev
> > Unsubscribe:
> > https://mail.python.org/mailman/options/python-dev/guido%40python.org
> >
>
>
>
> --
> --Guido van Rossum (python.org/~guido)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160405/b0bb8545/attachment-0001.html>


More information about the Python-Dev mailing list