Deriving from builtin types with limited instances and Extending FAQ 6.6
aleax at aleax.it
Sun Feb 9 16:19:41 CET 2003
Gerrit Holl wrote:
> >>> class A(iter): pass
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> TypeError: cannot create 'builtin_function_or_method' instances
> This one doesn't work either. The error message seems reasonable,
> becuase 'class A(map)' won't work either. However, what is exactly
> the difference with 'class A(int)'? I can also try:
This is exactly the difference: you can inherit from a TYPE (if
that type is designed to allow inheritance, and says so among
the flags in its C-level structure) but you can never inherit
from a FUNCTION.
More information about the Python-list