[Python-Dev] slightly inconsistent set/list pop behaviour
Antoine Pitrou
solipsis at pitrou.net
Wed Apr 8 11:42:49 CEST 2009
Mark Dickinson <dickinsm <at> gmail.com> writes:
>
> 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):
Not to mention that other implementations (Jython, etc.) will probably exhibit
yet different behaviour, and the CPython hash functions are not engraved in
stone either. If you want to write portable code, you can't rely on *any*
reproduceable ordering for random set member access.
Regards
Antoine.
More information about the Python-Dev
mailing list