◐ Shell
clean mode source ↗

bpo-40334: Support type comments by gvanrossum · Pull Request #19780 · python/cpython

added 4 commits

April 28, 2020 08:47
This does not yet support the "long form" for arguments with type
comments.

We also totally skip `# type: ignore` comments, and there is no
support for func_type_input yet.
This involved a complete refactor of the part of the grammar used to
recognise formal parameters in function definitions.  I renamed many
of the rules involved.

The rewrite always includes the comma following a parameter in that
argument, so that we can also include the type comment, if any (which
follows the comma).

The final parameter may not be followed by a comma, so we allow the
comma to be omitted, but only if a close parenthesis follows instead
(preceded by the type comment, if any).

Some additional complications are needed because the code generator
doesn't actually support alternatives that may be empty.

PS. I didn't refactor the corresponding rules for lambdas, since they
don't have type comments.

@gvanrossum gvanrossum changed the title bpo-40334: Support type comments bpo-40334: Support type comments [WIP]

Apr 29, 2020

@gvanrossum gvanrossum changed the title bpo-40334: Support type comments [WIP] bpo-40334: Support type comments

Apr 29, 2020

@gvanrossum

@gvanrossum

@gvanrossum

lysnikolaou

gvanrossum

lysnikolaou

lysnikolaou

lysnikolaou

@gvanrossum

lysnikolaou

@gvanrossum

lysnikolaou

@gvanrossum

lysnikolaou