syntax difference
Gregory Ewing
greg.ewing at canterbury.ac.nz
Mon Jun 18 10:08:44 EDT 2018
Bart wrote:
> I can remove comments by writing a tokeniser which scans Python source
> and re-outputs tokens one at a time. Such a tokeniser normally ignores
> comments.
What was being talked about wasn't removing *all* comments,
but removing just the ones that contain type hints.
> But to remove type hints, a deeper understanding of the input is needed.
> I would need a parser rather than a tokeniser.
Fortunately, Python comes with a parser for Python built
in (the ast module). So you get quite a good head start.
--
Greg
More information about the Python-list
mailing list