[SciPy-dev] Generic polynomials class (was Re: Volunteer for Scipy Project)
Charles R Harris
Tue Oct 13 09:49:31 CDT 2009
On Tue, Oct 13, 2009 at 8:14 AM, Pauli Virtanen <email@example.com<pav%2Bsp@iki.fi>
> Tue, 13 Oct 2009 08:00:30 -0600, Charles R Harris wrote:
> > I just don't think inheritance is appropriate here. I'll admit the
> > proposed implementation has a magicky flavor, but in my case that
> > arises because the programming idiom using closures is unfamiliar. In
> > C++ what I would have is a templated class, but python doesn't have
> > such, while it does have closures.
> If you also change the class names dynamically in the factory, there'll
> be less user confusion.
Well, the class identity is set by where it is instantiated. The isinstance
function will show that Dog and Cat are different classes, i.e., an instance
of Dog will fail in isinstance (mydog, Cat).
> Anyway, you write the code, you call the shots :)
Heh. I am looking for feedback before taking the plunge.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Scipy-dev