Soluții

Python isinstance()

The isinstance() function checks if the object (first argument) is an instance or subclass of classinfo class (second argument).

isinstance() returns:

  • True if the object is an instance or subclass of a class or any element of the tuple
  • False otherwise

If classinfo is not a type or tuple of types, a TypeError exception is raised.

[mai mult...]