change of random state when pyc created??

Carsten Haese carsten at uniqsys.com
Thu May 10 00:34:07 EDT 2007


On Thu, 10 May 2007 02:50:49 GMT, Alan Isaac wrote
> "Carsten Haese" <carsten at uniqsys.com> wrote in message
> news:mailman.7498.1178763619.32031.python-list at python.org...
> > Knowing that maps don't have reproducible ordering is one thing.
> > Realizing that that's the cause of the problem that's arbitrarily and
> > wrongly attributed to the 'random' module, in a piece of code that's not
> > posted to the public, and presumably not trimmed down to the shortest
> > possible example of the problem, is quite another.
> 
> There is no reason to be unfriendly about this.

I did not mean this to be unfriendly. I'm sorry if you got that impression. I
was simply pointing out all the ways in which you made it difficult for the
community to explain your problem.

> > I'll venture the guess that most Python programmers with a modicum of
> > experience will, when asked point blank if it's safe to rely on a
> > dictionary to be iterated in a particular order, answer no.
> 
> Again, that misses the point.  This is clearly documented.
> I would have said the same thing: no, that's not safe. But
> the question is whether the same people will be surprised when
> *unchanged* code rerun with an *unchanged* implementation
> produces *changed* results.

That only means that a program can behave non-deterministically if you're not
carefully restricting it to functions that are guaranteed to be deterministic.
No experienced software engineer, whether they are experienced in Python or
some other programming language should be surprised by this notion.

I don't think that the cause of non-determinism in your case was exceptionally
subtle, you just made it harder to find.

> The docs
> should not be useful only to the most sophisticated users.

Please feel free to suggest specific wording changes to make the documentation
more useful.

> > It does, at least for dicts: "Keys and values are listed in an arbitrary
> > order." If this wording is not present for sets, something to this
> > effect should be added.
> 
> Even Robert did not claim that *that* phrase was adequate.
> I note that you cut off "which is non-random"!

In my opinion, that phrase is adequate. I did cut off the non-random part
because it's irrelevant. Non-random doesn't mean deterministic.

Regards,

Carsten.




More information about the Python-list mailing list