Batuhan Taskaya added the comment:
> @BTaskaya I've seen this in third party ides and type checker. For example
> they are referring to "Union[Callable[[], Union[int, str]], None]" as "() ->
> (int | str) | None" where there are parentheses around the returns.
Though you can not simple
midori added the comment:
@BTaskaya I've seen this in third party ides and type checker. For example they
are referring to "Union[Callable[[], Union[int, str]], None]" as "() -> (int |
str) | None" where there are parentheses around the returns.
--
Batuhan Taskaya added the comment:
Hey @cleoold! Technically the second AST you gave is invalid (fun2),
considering that the FunctionType is not an expression;
mod = Module(stmt* body, type_ignore* type_ignores)
| FunctionType(expr* argtypes, expr returns)
expr =
New submission from midori :
Hi all, this is probably my first issue here, so don't blame me if I do
something wrong lol
The ast.FunctionType gives syntax like (a, b) -> c for function types, this is
ok, and also since Python 3.10 we can use X | Y to denote unions, this is ok.
So Given the