All I'm looking for is a list of possible values of classinfo
since the documentation doesn't provide one and I can't seem to find one anywhere else online, let alone SO.
isinstance() is a built-in Python method that allows you to verify a particular value's data type. For example, you can use isinstance() to check if a value is a string or a list.
The Python's isinstance() function checks whether the object or variable is an instance of the specified class type or data type. For example, isinstance(name, str) checks if name is an instance of a class str .
print([t for t in __builtins__.__dict__.values() if isinstance(t, type)])
Output (line-breaks inserted for readability):
[
<class '_frozen_importlib.BuiltinImporter'>,
<class 'bool'>,
<class 'memoryview'>,
<class 'bytearray'>,
<class 'bytes'>,
<class 'classmethod'>,
<class 'complex'>,
<class 'dict'>,
<class 'enumerate'>,
<class 'filter'>,
<class 'float'>,
<class 'frozenset'>,
<class 'property'>,
<class 'int'>,
<class 'list'>,
<class 'map'>,
<class 'object'>,
<class 'range'>,
<class 'reversed'>,
<class 'set'>,
<class 'slice'>,
<class 'staticmethod'>,
<class 'str'>,
<class 'super'>,
<class 'tuple'>,
<class 'type'>,
<class 'zip'>,
<class 'BaseException'>,
<class 'Exception'>,
<class 'TypeError'>,
<class 'StopAsyncIteration'>,
<class 'StopIteration'>,
<class 'GeneratorExit'>,
<class 'SystemExit'>,
<class 'KeyboardInterrupt'>,
<class 'ImportError'>,
<class 'ModuleNotFoundError'>,
<class 'OSError'>,
<class 'OSError'>,
<class 'OSError'>,
<class 'OSError'>,
<class 'EOFError'>,
<class 'RuntimeError'>,
<class 'RecursionError'>,
<class 'NotImplementedError'>,
<class 'NameError'>,
<class 'UnboundLocalError'>,
<class 'AttributeError'>,
<class 'SyntaxError'>,
<class 'IndentationError'>,
<class 'TabError'>,
<class 'LookupError'>,
<class 'IndexError'>,
<class 'KeyError'>,
<class 'ValueError'>,
<class 'UnicodeError'>,
<class 'UnicodeEncodeError'>,
<class 'UnicodeDecodeError'>,
<class 'UnicodeTranslateError'>,
<class 'AssertionError'>,
<class 'ArithmeticError'>,
<class 'FloatingPointError'>,
<class 'OverflowError'>,
<class 'ZeroDivisionError'>,
<class 'SystemError'>,
<class 'ReferenceError'>,
<class 'BufferError'>,
<class 'MemoryError'>,
<class 'Warning'>,
<class 'UserWarning'>,
<class 'DeprecationWarning'>,
<class 'PendingDeprecationWarning'>,
<class 'SyntaxWarning'>,
<class 'RuntimeWarning'>,
<class 'FutureWarning'>,
<class 'ImportWarning'>,
<class 'UnicodeWarning'>,
<class 'BytesWarning'>,
<class 'ResourceWarning'>,
<class 'ConnectionError'>,
<class 'BlockingIOError'>,
<class 'BrokenPipeError'>,
<class 'ChildProcessError'>,
<class 'ConnectionAbortedError'>,
<class 'ConnectionRefusedError'>,
<class 'ConnectionResetError'>,
<class 'FileExistsError'>,
<class 'FileNotFoundError'>,
<class 'IsADirectoryError'>,
<class 'NotADirectoryError'>,
<class 'InterruptedError'>,
<class 'PermissionError'>,
<class 'ProcessLookupError'>,
<class 'TimeoutError'>
]
and if you want list of strings:
print([t.__name__ for t in __builtins__.__dict__.values() if isinstance(t, type)])
Output:
[
'BuiltinImporter',
'bool',
'memoryview',
'bytearray',
'bytes',
'classmethod',
'complex',
'dict',
'enumerate',
'filter',
'float',
'frozenset',
'property',
'int',
'list',
'map',
'object',
'range',
'reversed',
'set',
'slice',
'staticmethod',
'str',
'super',
'tuple',
'type',
'zip',
'BaseException',
'Exception',
'TypeError',
'StopAsyncIteration',
'StopIteration',
'GeneratorExit',
'SystemExit',
'KeyboardInterrupt',
'ImportError',
'ModuleNotFoundError',
'OSError',
'OSError',
'OSError',
'OSError',
'EOFError',
'RuntimeError',
'RecursionError',
'NotImplementedError',
'NameError',
'UnboundLocalError',
'AttributeError',
'SyntaxError',
'IndentationError',
'TabError',
'LookupError',
'IndexError',
'KeyError',
'ValueError',
'UnicodeError',
'UnicodeEncodeError',
'UnicodeDecodeError',
'UnicodeTranslateError',
'AssertionError',
'ArithmeticError',
'FloatingPointError',
'OverflowError',
'ZeroDivisionError',
'SystemError',
'ReferenceError',
'BufferError',
'MemoryError',
'Warning',
'UserWarning',
'DeprecationWarning',
'PendingDeprecationWarning',
'SyntaxWarning',
'RuntimeWarning',
'FutureWarning',
'ImportWarning',
'UnicodeWarning',
'BytesWarning',
'ResourceWarning',
'ConnectionError',
'BlockingIOError',
'BrokenPipeError',
'ChildProcessError',
'ConnectionAbortedError',
'ConnectionRefusedError',
'ConnectionResetError',
'FileExistsError',
'FileNotFoundError',
'IsADirectoryError',
'NotADirectoryError',
'InterruptedError',
'PermissionError',
'ProcessLookupError',
'TimeoutError'
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With