My understanding of function parameters in Python is that they are like empty objects until function call and that's it. eg.
def square(x): #where x is an empty var defined here.
return x*x #for the scope of this function
So how does this work, where "NamedTuple" is a callback function I assume? Does "NamedTuple" return value gets used as the parameter to class Car()?
>>> from typing import NamedTuple
>>> class Car(NamedTuple):
... color: str
... mileage: float
... automatic: bool
>>> car1 = Car("red", 3812.4, True)
>>> # Instances have a nice repr:
>>> car1
Car(color='red', mileage=3812.4, automatic=True)
class Car(NamedTuple):
is a class declaration, not a function call.NamedTuple
is a class thatCar
is derived from.