bpo-40334: Support type comments by gvanrossum · Pull Request #19780 · python/cpython
added 4 commits
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
changed the title
bpo-40334: Support type comments
bpo-40334: Support type comments [WIP]
gvanrossum
changed the title
bpo-40334: Support type comments [WIP]
bpo-40334: Support type comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters