[Python-Dev] Parser module in the stdlib

Brett Cannon bcannon at gmail.com
Thu May 16 22:04:37 EDT 2019


On Thu., May 16, 2019, 15:56 Steve Dower, <steve.dower at python.org> wrote:

> On 16May2019 1548, Pablo Galindo Salgado wrote:
> >  > Will the folks using forks be happy to switch to the stdlib version?
> >>For example I can imagine that if black wants to process 3.7 input
> >>code while running on 3.6, it might prefer a parser on PyPI even if
> >>he stdlib version were public, since the PyPI version can be updated
> >>independently of the host Python.
> > The tool can parse arbitrary grammars, the one that is packed into is
> > just one of them.
> >
> > I think it would be useful, among other things because the standard
> library
> > lacks currently a proper CST solution. The ast module is heavily
> > leveraged for
> > things like formatters, static code analyzers...etc but CST can be very
> > useful as
> > Łukasz describes here:
> >
> > https://bugs.python.org/issue33337
> >
> > I think is missing an important gap in the stdlib and the closest thing
> > we have
> > (the current parser module) is not useful for any of that. Also, the
> > core to generating
> > the hypothetical new package (with some new API over it may be) is
> > already undocumented
> > as an implementation detail of lib2to3 (and some people are already
> > using it directly).
>
> We still have the policy of not removing modules that exist in the
> Python 2 standard library. But 3.9 won't be covered by that :)
>

Correct. 😁 We should deprecate in 3.8 for removal in 3.9.


> But I'm in favor of having a proper CST module that matches the version
> of Python it's in. It doesn't help people on earlier versions (yet), but
> given how closely tied it is to the Python version you're on I think it
> makes sense in the stdlib.
>

+1. I think someone brought up the API, and probably talking to projects
that are using pgen2 out of lib2to3 would be good.

-Brett


> Cheers,
> Steve
> _______________________________________________
> 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/brett%40python.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20190516/cd8f75c9/attachment-0001.html>


More information about the Python-Dev mailing list