You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@freider , you seem to know more about Python type hints that well...anyone. I appreciate your work in PRs like #2200
I was trying to declare new type hints for map, starmap, and for_each, because it bugs me that all function type information is lost if I call my modal functions in this way. I ran into some issues (that are no doubt the same issues you ran into) when trying to tell Python that a function like map takes "an iterator of the same type as the Params of the underlying function". The ParamSpec type appears to be very special in the way it is used, and I can't seem to coerce the P_INNER or P_INNER.args into anything useful for type hints on these.
The return-values for functions like map appear fixable though. It currently has:
But I think you could make use of the ReturnType for both of those functions (although it would likely require making AsyncOrSyncIterable a generic as well).
So, I don't know if it's possible to have type hints for these map-like functions, but boy it would be cool. :)
The text was updated successfully, but these errors were encountered:
@freider , you seem to know more about Python type hints that well...anyone. I appreciate your work in PRs like
#2200
I was trying to declare new type hints for map, starmap, and for_each, because it bugs me that all function type information is lost if I call my modal functions in this way. I ran into some issues (that are no doubt the same issues you ran into) when trying to tell Python that a function like map takes "an iterator of the same type as the Params of the underlying function". The
ParamSpec
type appears to be very special in the way it is used, and I can't seem to coerce the P_INNER or P_INNER.args into anything useful for type hints on these.The return-values for functions like map appear fixable though. It currently has:
But I think you could make use of the
ReturnType
for both of those functions (although it would likely require making AsyncOrSyncIterable a generic as well).So, I don't know if it's possible to have type hints for these map-like functions, but boy it would be cool. :)
The text was updated successfully, but these errors were encountered: