4 ms·
Is there an actual dummy class called `typing.Any` that will magically pass a type comparison against any other Python object? There is an object called "typin
by ubernostrum 8y ago
Is there an actual dummy class called `typing.Any` that will magically pass a type comparison against any other Python object?
There is an object called "typing.Any". It's a singleton, immutable, un-subclassable sentinel object for static type checking tools to recognize and handle. Runtime type checkers cannot work with it; it actually overrides both the __instancecheck__ and the __subclasscheck__ special methods to raise exceptions and forbid attempts to use runtime isinstance() or issubclass() checks against Any.