Message16833
In Python 2.2.3 there's a problem with accidental
subclassing from a Python module, e.g.
import MyStuff
class A(MyStuff):
pass
this gives no error until you try to instantiate the
class:
o = A()
TypeError: 'module' object is not callable
In Python 2.3 the error is generated at module
startup time:
class A(MyStuff):
pass
TypeError: function takes at most 2 arguments (3 given)
Since it is rather common that you create modules which
have the same name as their most important class, I
would find it more appropriate to raise a TypeError
with a message "can't subclass a module instance"
in both versions.
|
|
Date |
User |
Action |
Args |
2007-08-23 14:14:30 | admin | link | issue765228 messages |
2007-08-23 14:14:30 | admin | create | |
|