[Python-Dev] Tuples vs. lists

M.-A. Lemburg mal@lemburg.com
2002年2月05日 18:25:16 +0100


Aahz Maruch wrote:
>> M.-A. Lemburg wrote:
> >
> > For the BCD stuff Aahz was talking about, I'd suggest to have
> > a look at either arrays or cStringIO buffers.
>> cStringIO wouldn't work because I want to store ints. 

I was thinking of storing integers as chr(value) in these.
> Arrays might
> work, but I think I'll stick with tuples because they're a bit more
> familiar to most Pythonistas. I'm not too concerned with raw speed and
> efficiency before I convert the code to C; remember Knuth.

If you plan to convert this to C, why not have a look at mxNumber
first ? It's a wrapper around GMP and provides high performance
implementations for many numeric operations, e.g. it should be
easy to create a BCD type using the GMP (arbitrary length) 
longs and an additional C long for the decimal point position.
In fact, there's a GMP extension MPFR which tries to do just 
this.
-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting: http://www.egenix.com/
Python Software: http://www.egenix.com/files/python/

AltStyle によって変換されたページ (->オリジナル) /