Is there a way to explicitly state an argument to a function in python should be an array of some custom class?
i.e.
I can write the following function to enforce the type of the args
def foo_bar(foo: str, bar: int):
print("foo bar stuff")
But what if I want an argument to be an array of a custom class
class foobar():
def __init__(self):
...
def foo_bar(foo: str, bar: int, array_of_foobar: [foobar]):
print("foo bar stuff")
Is there a syntax to ensure the variable "array_of_foobar" is an array of the proper type?
To take it a step further, what if I have classes derived from class foobar() using AbstractBaseClass. Can I ensure the array if of type foobar, or derived from type foobar?