Strange metaclass behaviour

Christian Eder eder at tttech.com
Thu Mar 23 10:25:13 EST 2006


Ziga Seilnacht wrote:

> I hope that above explanation helps.
> 

Thanks for your support.
I now understand what happens here,
but I'm not really happy with the situation.
Your solution is a nice workaround, but in a quite 
huge and complex class framework with a lot a custom 
metaclasses you don't want this code in each __new__ 
function. And in fact each __new__ which does not contain this
fix-code (and which is not completely side-effect free) might
break if someone adds additional classes deeps down in the 
inheritance hierarchy (which is exactly what happened
for me). And this is clearly not what one should expect in
context of multiple inheritance and cooperative supercalls.

Raising a "metatype conflict among bases" error might be a 
perfectly acceptable behavior here (though it would be better if 
python resolves the conflict as your code does), but 
double-executing code is not in my humble opinion.

Is this worth a bug-report on sourceforge ?

regards
chris



More information about the Python-list mailing list