Re: [Python-Dev] Saving the hash value of tuples

2006-04-03 Thread Guido van Rossum
On 4/2/06, Noam Raphael <[EMAIL PROTECTED]> wrote: > On 4/2/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > I tried the change, and it turned out that I had to change cPickle a > > > tiny bit: it uses a 2-tuple which is allocated when the module > > > initializes to lookup tuples in a dict. I

Re: [Python-Dev] Saving the hash value of tuples

2006-04-02 Thread Raymond Hettinger
>> I've found out that the hash value of tuples isn't saved after it's >> calculated. With strings it's different: the hash value of a string is >> calculated only on the first call to hash(string), and saved in the >> structure for future use. Saving the value makes dict lookup of tuples >> an ope

Re: [Python-Dev] Saving the hash value of tuples

2006-04-02 Thread Noam Raphael
On 4/2/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > I tried the change, and it turned out that I had to change cPickle a > > tiny bit: it uses a 2-tuple which is allocated when the module > > initializes to lookup tuples in a dict. I changed it to properly use > > PyTuple_New and Py_DECREF,

Re: [Python-Dev] Saving the hash value of tuples

2006-04-02 Thread Guido van Rossum
On 4/1/06, Noam Raphael <[EMAIL PROTECTED]> wrote: > I've found out that the hash value of tuples isn't saved after it's > calculated. With strings it's different: the hash value of a string is > calculated only on the first call to hash(string), and saved in the > structure for future use. Saving

Re: [Python-Dev] Saving the hash value of tuples

2006-04-01 Thread Noam Raphael
Ok, I uploaded it. Patch no. 1462796: https://sourceforge.net/tracker/index.php?func=detail&aid=1462796&group_id=5470&atid=305470 On 4/1/06, Aahz <[EMAIL PROTECTED]> wrote: > On Sat, Apr 01, 2006, Noam Raphael wrote: > > > > I've found out that the hash value of tuples isn't saved after it's > >

Re: [Python-Dev] Saving the hash value of tuples

2006-04-01 Thread Aahz
On Sat, Apr 01, 2006, Noam Raphael wrote: > > I've found out that the hash value of tuples isn't saved after it's > calculated. With strings it's different: the hash value of a string is > calculated only on the first call to hash(string), and saved in the > structure for future use. Saving the val