subclassable types

Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de
Sun Feb 24 17:38:53 CET 2013


> The complete list of types classes that *cannot* be subclassed is:
> 
> <class 'builtin_function_or_method'>
> <class 'code'>
> <class 'frame'>
> <class 'function'>
> <class 'generator'>
> <class 'getset_descriptor'>
> <class 'function'>
> <class 'mappingproxy'>
> <class 'member_descriptor'>
> <class 'method'>
> <class 'traceback'>
> <class 'range'>
> <class 'memoryview'>
> <class 'slice'>
> <class 'bool'>
> 
> of these range, memoryview, slice and bool are the only ones in builtins. 

I am sorry,
but again I forgot to say which Python version I'm referring to:
I used Python 3.3 :)

Having such a list in the docs somewhere, is certainly a good idea.

Cheers,
Wolfgang





More information about the Python-list mailing list