I’m assuming you understand a “normal” function definition:
def match_nus_uuid(device, adv):
startig a function with 2 parameters? Within the function you will have
2 variables named “device” and “adv” having the values supplied when the
function is called?
The more elaborate definition you have cited:
def match_nus_uuid(device: BLEDevice, adv: AdvertisementData):
has type annotations, essentially assertions that the value passed as
“device” will be of type/class “BLEDevice” and that the value passed as
“adv” will be of type/class “AdvertisementData”.
Python variables are not typed, though the values are. One could call
this function and pass “foo” (which is of type “str”) as “device” and
Python would accept it.
A type annotation says that we expect a specific type of value.
Note: these annotations are not checked at run time and have no run
However you can use these annotations with static type checking
programmes which examine the programme code and report inconsistencies
between the values it would pass and the type annotations you have
Cameron Simpson email@example.com