Sebastian Rittau
Sebastian Rittau
That shouldn't be necessary, I think, but I don't particularly mind either way.
Another use case - at least util we get a more flexible `Callable` syntax - is for optional arguments in callback functions, like WSGI's `start_response()`: ```python StartResponse = AnyOf[ Callable[[str,...
Good to know that there is a proper solution for the callback case! Personally, I think the improvement in type safety over just returning `Any` would be worth it. It...
I brought this up on typing-sig.
Maybe I'm misunderstanding how intersections are supposed to work, but to me an intersection type is a type that fulfills the protocol of multiple other types. At least that's how...
And that means that `AnyOf` has not much relation to intersections. Like `Union`, it's more meant to be an "either/or" situation. For example, the following would work with `AnyOf`, but...
And sorry for the spam, but one last thought: For the caller of a function, there is no difference, whether an argument is annotated with `AnyOf` of `Union`. In fact,...
So to recap. For argument types: ```python # For the callee (receiver), AnyOf and Intersection are equivalent: def foo1(x: AnyOf[str, StringIO]): do_str_stuff(x.getvalue() if hasattr(x, "getvalue") else x) def foo2(x: str...
@hmc-cs-mdrissi That's a good point about type aliases and quotes. A brief explanation of the future import makes sense. I think that this explanations (as well as explanation about using...
I believe this is about the very rudamentary documentation at typing.readthedocs.io? In which case, we can just add the links in the repository here. PR welcome!