I'm trying to understand how Python's type annotations work (e.g. List
and Dict
- not list
or dict
). Specifically I'm interested in how isinstance(list(), List)
works, so that I can create my own custom annotations.
I see that List
is defined as:
class List(list, MutableSequence[T], extra=list):
. . .
I'm familiar with metaclass = xxx
but I can't find any documentation on this extra = xxx
. Is this a keyword or just an argument, and if so, where does it come from and does it do what I'm after? Is it even relevant for isinstance
?