> foo = set([1, 65537])
> foo.pop()
>> 1
> foo = set([65537, 1])
> foo.pop()
>> 65537
>
> 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.
Well, Mark is th
2009/4/8 Steve Holden :
> Paul Moore wrote:
>> 2009/4/8 Duncan Booth :
>>> Andrea Griffini wrote:
>>>
On Wed, Apr 8, 2009 at 12:57 PM, Jack diederich
wrote:
> You wrote a program to find the two smallest ints that would have a
> hash collision in the CPython set implementation?
Paul Moore wrote:
> 2009/4/8 Duncan Booth :
>> Andrea Griffini wrote:
>>
>>> On Wed, Apr 8, 2009 at 12:57 PM, Jack diederich
>>> 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 impr
2009/4/8 Duncan Booth :
> Andrea Griffini wrote:
>
>> On Wed, Apr 8, 2009 at 12:57 PM, Jack diederich
>> 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.
>>
Andrea Griffini wrote:
> On Wed, Apr 8, 2009 at 12:57 PM, Jack diederich
> 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(
On Wed, Apr 8, 2009 at 12:57 PM, Jack diederich 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()
Andrea
_
Jack diederich wrote:
> On Wed, Apr 8, 2009 at 2:44 AM, Mark Dickinson wrote:
>> On Wed, Apr 8, 2009 at 7:13 AM, John Barham wrote:
>>> If you play around a bit it becomes clear that what set.pop() returns
>>> is independent of the insertion order:
>> It might look like that, but I don't think th
On Wed, Apr 8, 2009 at 2:44 AM, Mark Dickinson wrote:
> On Wed, Apr 8, 2009 at 7:13 AM, John Barham wrote:
>> If you play around a bit it becomes clear that what set.pop() returns
>> is independent of the insertion order:
>
> It might look like that, but I don't think this is
> true in general (a
Mark Dickinson gmail.com> writes:
>
> On Wed, Apr 8, 2009 at 7:13 AM, John Barham gmail.com> wrote:
> > If you play around a bit it becomes clear that what set.pop() returns
> > is independent of the insertion order:
>
> It might look like that, but I don't think this is
> true in general (at l
On Wed, Apr 8, 2009 at 7:13 AM, John Barham wrote:
> If you play around a bit it becomes clear that what set.pop() returns
> is independent of the insertion order:
It might look like that, but I don't think this is
true in general (at least, with the current implementation):
>>> foo = set([1, 65
Tennessee Leeuwenburg wrote:
> Now, I know that sets aren't ordered, but...
>
> foo = set([1,2,3,4,5])
> bar = [1,2,3,4,5]
>
> foo.pop() will reliably return 1
> while bar.pop() will return 5
>
> discuss :)
As designed.
If you play around a bit it becomes clear that what set.pop() returns
is inde
[Tennessee Leeuwenburg ]
Now, I know that sets aren't ordered, but...
foo = set([1,2,3,4,5])
bar = [1,2,3,4,5]
foo.pop() will reliably return 1
while bar.pop() will return 5
discuss :)
If that's what you need:
http://code.activestate.com/recipes/576694/
Raymond
__
Now, I know that sets aren't ordered, but...
foo = set([1,2,3,4,5])
bar = [1,2,3,4,5]
foo.pop() will reliably return 1
while bar.pop() will return 5
discuss :)
Cheers,
-T
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailma
13 matches
Mail list logo