[issue6829] Frendly error message when inheriting from function

anatoly techtonik report at bugs.python.org
Thu Sep 3 09:20:20 CEST 2009


New submission from anatoly techtonik <techtonik at gmail.com>:

It is an error to try to inherit from function and the error message in 
this case is:
{{{
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "m:\p\pb.py", line 4, in <module>
    class PostgreSQLConnection(DatabaseConnection):
TypeError: Error when calling the metaclass bases
    function() argument 1 must be code, not str
}}}

Something like 'Impossible to inherit from function' will clear 
confusion state from users unfamiliar with metaclasses.
{{{
def DatabaseConnection(object):
    pass

class PostgreSQLConnection(DatabaseConnection):
    pass
}}}

----------
components: Interpreter Core
messages: 92191
nosy: techtonik
severity: normal
status: open
title: Frendly error message when inheriting from function
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6829>
_______________________________________


More information about the Python-bugs-list mailing list