8000 add an essay explaining the return annotation · python/cpython@a5103be · GitHub
[go: up one dir, main page]

Skip to content

Commit a5103be

Browse files
authored
add an essay explaining the return annotation
1 parent bdd377c commit a5103be

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Tools/clinic/clinic.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4283,6 +4283,11 @@ class float_return_converter(double_return_converter):
42834283
cast = '(double)'
42844284

42854285

4286+
# What do we do in this function?
4287+
# We take an arbitrary AST node, compile the node into a function object,
4288+
# call that function with 0 arguments, and return whatever the call returns.
4289+
# The only possible return annotations here would be `object` or `Any`,
4290+
# and `object` would be too annoying. Return `Any`!
42864291
def eval_ast_expr(
42874292
node: ast.expr,
42884293
globals: dict[str, Any],

0 commit comments

Comments
 (0)
0