[Python-Dev] slightly inconsistent set/list pop behaviour (original) (raw)
Steve Holden steve at holdenweb.com
Wed Apr 8 13:57:09 CEST 2009
- Previous message: [Python-Dev] slightly inconsistent set/list pop behaviour
- Next message: [Python-Dev] slightly inconsistent set/list pop behaviour
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Jack diederich wrote:
On Wed, Apr 8, 2009 at 2:44 AM, Mark Dickinson <dickinsm at gmail.com> wrote:
On Wed, Apr 8, 2009 at 7:13 AM, John Barham <jbarham at 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 least, with the current implementation):
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. Given the two numbers in question (1, 2**16+1) I suspect this is the result of analysis rather than algorithm.
regards Steve
Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ Watch PyCon on video now! http://pycon.blip.tv/
- Previous message: [Python-Dev] slightly inconsistent set/list pop behaviour
- Next message: [Python-Dev] slightly inconsistent set/list pop behaviour
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]