Replies: 2 comments 3 replies
-
It makes sense to me to have these type aliases. For now, the easiest is to add them to the |
Beta Was this translation helpful? Give feedback.
2 replies
-
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from _typeshed import ConvertibleToInt |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Like the original poster of this Stack Overflow question, I have some functions with a parameter accepting any arguments that can be converted to
int
(using theint()
built-in function). This is the type hint that I am currently using (based ontypeshed
, and I am not even sure that this list is exhaustive):It would be so much more convenient if I did not have to maintain that list.
So what do you think about adding the following type hints to the
typing
module?ConvertibleToInt
, equal toUnion[SupportsInt, SupportsIndex, SupportsTrunc, str, bytes, bytearray]
;ConvertibleToFloat
, equal toUnion[SupportsFloat, SupportsIndex, str, bytes, bytearray]
;ConvertibleToComplex
, equal toUnion[SupportsComplex, SupportsIndex, str, complex]
.Beta Was this translation helpful? Give feedback.
All reactions