S SearchRSS
< BackHome
Newest questions tagged python - Stack Overflow

Difference between three forms of instantiating a generic class in Python

I have this generic class in Python 3.12 1: class Box[T]: def __init__(self, val: T): self.val = val I can instantiate it in 3 ways: box: Box[int] = Box(42) box = Box[int](42) box = Box(42) What's the dif

View original source