subclassable types

Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de
Sun Feb 24 11:38:53 EST 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