On Sun, May 15, 2011 at 4:18 AM, Steven D'Aprano
wrote:
> On Sun, 15 May 2011 11:11:41 +0200, Christoph Groth wrote:
>
>> I would like to avoid having _multiple_ objects which are equal (a == b)
>> but not the same (a is not b). This would save a lot of memory.
>
> Based on the idea of interning,
On Sun, May 15, 2011 at 1:53 PM, Terry Reedy wrote:
> On 5/15/2011 6:46 AM, Christoph Groth wrote:
>> But hey, they keys of my dictionary are actually strings, so I can use
>> the built-in intern. Somehow, I have never stumbled accross this
>> built-in function so far.
>
> It was, however, remov
On 5/15/2011 6:46 AM, Christoph Groth wrote:
Steven D'Aprano writes:
On Sun, 15 May 2011 11:11:41 +0200, Christoph Groth wrote:
I would like to avoid having _multiple_ objects which are equal (a ==
b) but not the same (a is not b). This would save a lot of memory.
Python hashed collection
Steven D'Aprano writes:
> On Sun, 15 May 2011 11:11:41 +0200, Christoph Groth wrote:
>
>> I would like to avoid having _multiple_ objects which are equal (a ==
>> b) but not the same (a is not b). This would save a lot of memory.
>
> Based on the idea of interning, which is used for Python strin
On Sun, 15 May 2011 11:11:41 +0200, Christoph Groth wrote:
> I would like to avoid having _multiple_ objects which are equal (a == b)
> but not the same (a is not b). This would save a lot of memory.
Based on the idea of interning, which is used for Python strings:
cache = {}
def my_intern(obj)
Chris Rebert writes:
> On Sun, May 15, 2011 at 1:28 AM, Christoph Groth wrote:
>> I use a huge python dictionary where the values are lists of that
>> dictionary's keys (yes, a graph). Each key is thus referenced
>> several times.
>>
>> As the keys are rather large objects, I would like to save
On Sun, May 15, 2011 at 1:28 AM, Christoph Groth wrote:
> Dear python experts,
>
> I use a huge python dictionary where the values are lists of that
> dictionary's keys (yes, a graph). Each key is thus referenced several
> times.
>
> As the keys are rather large objects, I would like to save memo
Dear python experts,
I use a huge python dictionary where the values are lists of that
dictionary's keys (yes, a graph). Each key is thus referenced several
times.
As the keys are rather large objects, I would like to save memory by
re-using key objects wherever possible, instead of having sever