Skip to content
Merged
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
Prev Previous commit
Improve docstring slightly
  • Loading branch information
AlexWaygood committed Jul 29, 2023
commit 6df4ba30b9f10dbc026691edb2f121497953c763
5 changes: 3 additions & 2 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4290,8 +4290,9 @@ def eval_ast_expr(
filename: str = '-'
) -> Any:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we add a comment as to why Any is the correct annotation here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You weren't going to make finally closing that issue easy, were you? ;)

Let me know if a5103be is too verbose...!

Copy link
Copy Markdown
Member Author

@AlexWaygood AlexWaygood Jul 28, 2023

Choose a reason for hiding this comment

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

Hmm, actually, now that I look at it again, the comment feels like it duplicates the docstring a little bit... not sure if it's worth it? I'll defer to you on whether it's helpful or not!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, you're right. The docstring should be enough!

Copy link
Copy Markdown
Member Author

@AlexWaygood AlexWaygood Jul 29, 2023

Choose a reason for hiding this comment

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

Okay -- removed the comment again and tweaked the docstring slightly! How's it look now?

"""
Takes an ast.Expr node. Compiles and evaluates it.
Returns the result of the expression.
Takes an ast.Expr node. Compiles it into a function object,
then calls the function object with 0 arguments.
Returns the result of that function call.

globals represents the globals dict the expression
should see. (There's no equivalent for "locals" here.)
Expand Down