On Fri, Nov 11, 2011 at 10:14 AM, Jonathan <tart...@tartley.com> wrote:
> Hey René,
> Thanks for that! I guess I was getting distracted because I was interpreting
> the situation as the fact that .items() for an *arbitrary* dictionary may
> well be non-deterministic, but in this particular case, for dictionaries
> newly-created by the '**' mechanism, they appear to be non-deterministic. I
> was forgetting that this is (presumably) also an implementation detail.
> Regardless, it sounds like you are probably right on all counts. Thanks for
> your enlightening thoughts.
> Cheers,
>     Jonathan

René is indeed correct to in what he says, but I think you are also
correct to want to write a test case that shows the code is not
depending on the dict order. Or in other words it is useful to have
the counterexample I supplied, but the absence of a counterexample
still wouldn't be an excuse for not fixing the code.

Likewise there was a question on SO about using (s is "") to test for
empty strings. There is a counterexample for Python 2.x but not so far
as I know for Python 3.x but that still means people shouldn't do it
in Python 3.x (the questioner in that case knew that but they wanted
an example to throw at their colleague).
_______________________________________________
python-uk mailing list
python-uk@python.org
http://mail.python.org/mailman/listinfo/python-uk

Reply via email to