StaticTuple... naming, maintenance, ...

Martin Pool mbp at canonical.com
Tue Oct 6 03:44:40 BST 2009


2009/10/6 John Arbash Meinel <john at arbash-meinel.com>:
> I just had another serious question. What to do about the pure-python
> fallback code?
>
> At the very beginning, I wrote the code so that it was (effectively):
>
> def StaticTuple(*args):
>  return args
>
> So you were left with just a simple tuple object. However, Robert
> rightly pointed out that it would be nice to have an object that we
> could possible add attributes to, and I even added ".intern()" specifically.
>
> However, if we use that layer of abstraction, it is going to *double*
> the pure-python memory consumption. Since you know have a GC tuple + a
> GC wrapper class (with one member)...
>
> Should I make ".intern()" a module level function? Or just live with the
> statement "we don't make special treatment for pure python code, if you
> want low memory and speed, compile the extensions."

The Python code ought to emphasize clarity.  That said, we do want it
to be usable, and doubling the memory use would be a heavy price.  So
I think putting the intern code into a function that can be called,
passing such an object, would be a reasonable price.  Up to you.

-- 
Martin <http://launchpad.net/~mbp/>



More information about the bazaar mailing list