Message53271
Logged In: YES
user_id=31435
I'm not sure this is making progress. Paul, if you want to
use marshal, you already can: the pack and unpack routines
are exposed in Python via the marshal module. Freezing the
representation isn't a particularly appealing idea; e.g.,
if anyone is likely to complain about the speed of Python's
longs, it's you <wink>, and the current marshal format for
longs is just a raw dump of Python's internal long
representation -- but the most obvious everything-benefits
way to speed Python longs is to increase the size of
the "digits" used in its internal representation. If
that's ever done, the marshal format would want to change
too.
It's easy enough to code your own storage format for longs,
e.g.
>>> def tobin(i):
... import binascii
... ashex = hex(long(i))[2:-1] # chop '0x' and
trailing 'L'
... if len(ashex) & 1:
... ashex = '0' + ashex
... return binascii.unhexlify(ashex)
implements "base 256" for unsigned longs, and the runtime
cannot be improved by rewriting in C except by a constant
factor (the Python spelling has the right O() behavior).
|
|
Date |
User |
Action |
Args |
2007-08-23 16:01:32 | admin | link | issue467384 messages |
2007-08-23 16:01:32 | admin | create | |
|