Steven D'Aprano <st...@remove-this-cybersource.com.au> writes: > On Fri, 18 Jun 2010 16:30:00 +0200, Christoph Groth wrote: > >> If other is of type Base already, just "pass it on". Otherwise, >> construct an instance of Base from it. >> >> **************************************************************** import >> numpy as np >> >> class Base: >> def __init__(self, other): >> if isinstance(other, type(self)): >> self = other >> return > > This does not do what you think it does. I wonder whether you've > actually tried it?
Just quickly. Sorry, I should have written class Base: def __init__(self, other): if isinstance(other, type(self)): self.a = other.a self.b = other.b self.c = other.c self.d = other.d return # ... -- http://mail.python.org/mailman/listinfo/python-list