change of random state when pyc created??
Alan Isaac
aisaac at american.edu
Wed May 9 09:42:53 EDT 2007
"Peter Otten" <__peter__ at web.de> wrote in message
news:f1rt61$kfg$03$1 at news.t-online.com...
> Alan Isaac wrote:
> There is nothing wrong with the random module -- you get the same numbers
on
> every run. When there is no pyc-file Python uses some RAM to create it and
> therefore your GridPlayer instances are located in different memory
> locations and get different hash values. This in turn affects the order in
> which they occur when you iterate over the GridPlayer.players_played set.
Thanks!!
This also explains Steven's results.
If I sort the set before iterating over it,
the "anomaly" disappears.
This means that currently the use of sets
(and, I assume, dictionaries) as iterators
compromises replicability. Is that a fair
statement?
For me (and apparently for a few others)
this was a very subtle problem. Is there
a warning anywhere in the docs? Should
there be?
Thanks again!!
Alan Isaac
More information about the Python-list
mailing list