Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

[2.7, 3.5] Support the per-argument function comment syntax #5

Merged
merged 7 commits into from
Jun 22, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ast27/Parser/Python.asdl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ module Python version "$Revision$"
excepthandler = ExceptHandler(expr? type, expr? name, stmt* body)
attributes (int lineno, int col_offset)

-- the type comments are used only in the multiline type comment syntax
-- type_comments is used to support the per-argument type comment syntax.
-- It is either an empty list or a list with length equal to the number of
-- args (including varargs and kwargs, if present) and with members set to the
-- string of each arg's type comment, if present, or None otherwise.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this aligned funny, or is GitHub displaying it in a surprising way?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file uses tabs. Fixed

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. :)

arguments = (expr* args, identifier? vararg,
identifier? kwarg, expr* defaults, string* type_comments)

Expand Down
2 changes: 1 addition & 1 deletion typed_ast/ast35.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- `parse` has been augmented so it can parse function signature types when
called with `mode=func_type`.
- `Module` has a `type_ignores` field which contains a list of
lines which have been `# type: ignored`.
lines which have been `# type: ignore`d.

An abstract syntax tree can be generated by using the `parse()`
function from this module. The result will be a tree of objects whose
Expand Down