Re: dict duplicity

2005-08-18 Thread Randy Bush
> Firstly, to remove one possible source of confusion, change the name of > your dictionary ... "mydict" or "fred" ... anything but "dict" > > Next, after you have created the dictionary and added items to it, do this: > print len(fred) > print len(fred.items()) > nitems = 0 > for k, v in fred.it

Re: dict duplicity

2005-08-18 Thread Steven Bethard
Randy Bush wrote: >for pKey, pVal in dict.iteritems(): > print \ > pKey[0], hash(pKey[0]), \ > pKey[1], hash(pKey[1]), \ > pKey[2], hash(pKey[2]), \ > "hash=", hash(pKey), \ > pVal[0], hash(pVal[0]), \ > pVal[1], hash(pVal[1]) > > whe

Re: dict duplicity

2005-08-18 Thread John Machin
Randy Bush wrote: > a dict written as > >pKey = (prefix, pLen, origin) > >val = dict.get(pKey) >if val == None: > dict[pKey] = (timeB, timeB) >else: > if val[0] > timeB: val[0] = timeB > if val[1] < timeB: val[1] = timeB > dict[pKey] = val > > and read b

Re: dict duplicity

2005-08-18 Thread Randy Bush
>> a dict written as >> >>pKey = (prefix, pLen, origin) >> >>val = dict.get(pKey) >>if val == None: >> dict[pKey] = (timeB, timeB) >>else: >> if val[0]> timeB: val[0] = timeB >> if val[1] < timeB: val[1] = timeB >> dict[pKey] = val >> >> and read back as

Re: dict duplicity

2005-08-18 Thread Paolino
Randy Bush wrote: > a dict written as > >pKey = (prefix, pLen, origin) > >val = dict.get(pKey) >if val == None: > dict[pKey] = (timeB, timeB) >else: > if val[0] > timeB: val[0] = timeB > if val[1] < timeB: val[1] = timeB > dict[pKey] = val > > and read b

dict duplicity

2005-08-18 Thread Randy Bush
a dict written as pKey = (prefix, pLen, origin) val = dict.get(pKey) if val == None: dict[pKey] = (timeB, timeB) else: if val[0] > timeB: val[0] = timeB if val[1] < timeB: val[1] = timeB dict[pKey] = val and read back as for pKey, pVal in dict.iteritems(