[Edu-sig] Properties use case
ajsiegel at optonline.net
Thu Mar 16 04:54:16 CET 2006
kirby urner wrote:
>>Is there a mechanism to con Numeric here?
>I'm interested in your question and therefore presumably in the
>answer. However, I'm not running Numeric these days, for the simple
>reason that it's not currently a part of my Python curriculum.
Appreciate your interest. I think it is an interesting question in that
it in some sense represents a clash between "technical" typing and duck
typing. My mutable complex number quacks (almost) exactly like the
immutable one, and usually in Python that might be enough to have it
accepted as being of the same type. Numeric seems to be catching me on
a technicality. Technology seems to full of the damn things ;)
The array object of Numeric is actually the C multiarray object. And
Numeric is perhaps thinking more in C than in Python in using a
technical rather than functional definition of type. Unfortunately it
seems to be a bit too daunting to me to attempt to follow the trail into
the C code to try to track down the error that's generated when I
(innocently ;) try to cast an array of the mutable complex numbers to
the Numeric complex array type.
Neither have I tried yet to see if the more recent numarray and numpy
libraries behave any differently here.
>We create a matrix object, maybe a quaternion object, in order to
>rotate our polyhedron objects (assemblages of face-defining tuples,
>each element a vertex in a dictionary of vectors -- e.g. the 26 A-Z of
>the concentric hierarchy):
>http://www.4dsolutions.net/ocn/oop7.html (see graphic top right).
>So I don't need linear algebra from Numeric at this time, nor any of
>its other resources. Not saying I won't in future. Numpy is cool
I actually think your way is best to achieve ultimate transparency for
pedagogical purposes, even at the sacrifice of performance. I am more
and more thinking that a good deal of Numeric is overkill for my
purposes as well - sacrificing transparency for what is probably not
tremendous performance benefits when I am dealing only in 2x2, 3x3 and
4x4 arrays. Since Numeric is designed as a general use library, it
needs to spend some time determining what it is looking at when, for
example, doing linear algebra - what shape are the arrays it is looking
at, what type, etc. In the controlled environment that I am working in
in PyGeo I know what I am sending along, so I think I can gain some of
the time back that I would be loosing in going from C to Python simply
because I can design things in a way where little is general, everything
is specific - we know what we are getting because we are sending it.
Have been experimenting with all this, as it happens.
More information about the Edu-sig