[Baypiggies] suggested meeting topic
b8sjidb02 at sneakemail.com
Sun Jul 9 21:47:22 CEST 2006
I saw ScientificPython a while back, and it looks very impressive but I
have not used it. It is far more comprehensive than my scalar class, but
let me briefly explain what I think is the unique contribution of my
I started working on it basically as a training excercize. After I had
it working, I decided to test it for efficiency. I was appalled at what
I discovered. Operations on it were two orders of magnitude (~100x)
slower than the same operations on float types! I considered that
I added an option to turn off the unit tracking and checks. However,
this only sped it up by one order of magnitude, leaving it still an
order of magnitude slower than built-in types. Apparently, just having
it as a user-defined class slows it down considerably compared to
built-in numeric types.
So I decided to try something more innovative. I wanted the user to be
able to transparently switch from the scalar class to built-in types by
changing only the import line. The user could then use the scalar class
during development to catch unit errors, but then easily turn it off and
revert back to built-in numeric types for efficient production runs.
I also wanted to be able to do it without the need to maintain two
nearly identical files. This created a unique challenge that I
eventually solved with a creative use of "execfile," but I won't go into
the details here.
I welcome anyone to look at what I did and suggest a simpler alternative
if there is one. All I ask is that you please try to understand the
problem before you fire back.
Again, you can find the code at http://RussP.us/scalar.htm
Aahz aahz-at-pythoncraft.com |Python Interest Group| wrote:
> On Sat, Jul 08, 2006, Russ Paielli wrote:
>>I have also developed a nifty Python class/package for handling physical
>>units. I am using it for the conflict alerting system. You can download
>>it or read about it at
> Sounds good! Check out
> for comparison.
More information about the Baypiggies