tomer filiba wrote:

> b=B() # error, A.__init__ expects an instanc of A
> 
> why is this kind of type-checking enforced by the language?

Since type-class unification, there is no clear boundary
between built-in and user-defined classes. Any class can
potentially add C-level data to its instances and have
methods implemented in C that operate on it. If you were
allowed to pass any object to any method, there would
be a danger of crashing the interpreter.

> what this code does is basically changing the __mro__ of the object. had
> __mro__ been mutable, it would all be simpler.

Being able to change the mro after class creation would
lead to similar problems.

--
Greg
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to