StaticTuple... naming, maintenance, ...

John Arbash Meinel john at
Tue Oct 6 19:33:35 BST 2009

Hash: SHA1

4) Another fundamental question.

Should these compare identical to their equivalent tuples.

Right now:

  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:

rather than

  if type(x) in (tuple, StaticTuple)

I'm not 100% positive, but we may also be able to get away with:

class StaticTuple(tuple):
  def __init__(self, *args):
    # Check that self.args is valid.
    tuple.__init__(self, args)

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.

Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla -


More information about the bazaar mailing list