python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
How to typecheck real numbers, and type-safely compare them to ints
I have a function that inputs a real number. In practice it might be an int or a float. and I want it to check if it is >0
For example
def f(x):
return x > 0
Now I want that function to be t...
Nephanth
Votes: 0
Answers: 0
Python Generics: cannot be assigned to declared type "T@func"
I'm trying to introduce Generic typing to a function of mine, but am getting a pylance error of:
Expression of type "A" cannot be assigned to declared type "T@func"
Type "A&...
dvreed77
Votes: 0
Answers: 1
When type hinting python functions, why are `*args` and `**kwargs` trearted differently?
I'm learning my way around type hints in modern python, specifically how to express the type of functions and their parameters.
If I have a function f and I know nothing about it, I can write its type...
CutOnBumInBand
Votes: 0
Answers: 0
How to type hint a function returning a generic type and conformance to a Protocol in Python
If I have a function taking in an instance of type T, and outputting that same instance but modified so it additionally conforms to a Protocol, how should I type hint that? My main goal is to allow my...
Stavr0s
Votes: 0
Answers: 0