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 -- https://mail.python.org/mailman/listinfo/python-list