2009/4/8 Steve Holden <st...@holdenweb.com>:
> Paul Moore wrote:
>> 2009/4/8 Duncan Booth <duncan.bo...@suttoncourtenay.org.uk>:
>>> Andrea Griffini <griph...@gmail.com> wrote:
>>>
>>>> On Wed, Apr 8, 2009 at 12:57 PM, Jack diederich <jackd...@gmail.com>
>>>> wrote:
>>>>> You wrote a program to find the two smallest ints that would have a
>>>>> hash collision in the CPython set implementation?  I'm impressed.
>>>>>  And by impressed I mean frightened.
>>>> ?
>>>>
>>>> print set([0,8]).pop(), set([8,0]).pop()
>>> If 'smallest ints' means the sum of the absolute values then these are
>>> slightly smaller:
>>>
>>>>>> print set([-1,6]).pop(), set([6,-1]).pop()
>>> 6 -1
>>
>> Can't resist:
>>
>>>>> print set([-2,-1]).pop(), set([-1,-2]).pop()
>> -1 -2
>>
>>>> a = 0.001
>>>> b = 0.002
>>>> print set([a, b]).pop(), set([b, a]).pop()
> 0.002 0.001

Cheat! We were using integers...

:-)

Paul.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to