Skip to content Skip to sidebar Skip to footer

Is There A Way To Pass An Array To A Python Generic?

I am doing some meta programming, and I need a way to define type hints on the fly. Is there a way to pass an array of arguments to a type hint? Something like: # Some programatica

Solution 1:

Ok - I found the syntax by rummaging around in typing.py:

return Union[tuple(permitted_types)]

Post a Comment for "Is There A Way To Pass An Array To A Python Generic?"