StaticTuple... naming, maintenance, ...
John Arbash Meinel
john at arbash-meinel.com
Tue Oct 6 19:33:35 BST 2009
-----BEGIN PGP SIGNED MESSAGE-----
4) Another fundamental question.
Should these compare identical to their equivalent tuples.
StaticTuple(a, b) == (a, b)
In all ways (including hash()).
I wrote it this way to make them a trivial 'drop-in' replacement
wherever we want to put them.
The good of that is that it makes it easier to migrate. The bad of that
is that it makes it easier to change something and no longer maintain
the decreased memory consumption.
If we forced keys to be StaticTuples, it would effect quite a bit of
code, but then that code would be guaranteed to stay in that state.
Since apis would say:
if type(x) is StaticTuple:
if type(x) in (tuple, StaticTuple)
I'm not 100% positive, but we may also be able to get away with:
def __init__(self, *args):
# Check that self.args is valid.
And then preserve a pure-python class that doesn't wrap tuple, but just
extends it slightly. That should also get around the memory consumption
issue I brought up earlier.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
More information about the bazaar