Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19894
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: difference between random module in python 2.6 and 3.2? |
| Date | 2012-02-06 02:27 -0500 |
| References | <jgna4q$1t08$1@ns.felk.cvut.cz> <4f2f5081$0$29992$c3e8da3$5496439d@news.astraweb.com> <mailman.5464.1328504850.27778.python-list@python.org> <4f2f6b87$0$29992$c3e8da3$5496439d@news.astraweb.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5469.1328513256.27778.python-list@python.org> (permalink) |
On 2/6/2012 12:56 AM, Steven D'Aprano wrote: > On Mon, 06 Feb 2012 00:07:04 -0500, Terry Reedy wrote: > >> On 2/5/2012 11:01 PM, Steven D'Aprano wrote: >> >>> Reading the docs, I would expect that when using an int as seed, you >>> should get identical results. >> >> That is similar to expecting hash to be consistent from version to >> version. > > No. hash is not intended to be consistent across versions, or even across Oh, but it was. Changing it will break tests, including some in the Python test suite. ... > This, plus Raymond Hettinger's comments on the bug report, make me think > that the change in behaviour of randrange and choice is not deliberate As I said, it was a necessary consequence of a bug fix. > and should be treated as a bug. Raymond made a strong case arguing for > repeatability, and then approved a bug fix that broke repeatability. I > doubt that was deliberate. It was deliberate that randrange was changed to an even distribution from a slightly uneven distribute. That implies a change in the pattern. That was known and the main subject of discussion. As Antoine said, making functions exactly repeatable across versions means not fixing bugs or otherwise improving them. This statement is not limited to the random module. You have persuaded me that the doc should be more explicit that while the basic random.random sequence will be kept repeatable with seed set (except perhaps after a changeover of several releases), the convenience transformations can be changed if improvements are needed or thought sufficiently desirable. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
difference between random module in python 2.6 and 3.2? Matej Cepl <mcepl@redhat.com> - 2012-02-06 02:27 +0100
Re: difference between random module in python 2.6 and 3.2? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-06 04:01 +0000
Re: difference between random module in python 2.6 and 3.2? Terry Reedy <tjreedy@udel.edu> - 2012-02-06 00:07 -0500
Re: difference between random module in python 2.6 and 3.2? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-06 05:56 +0000
Re: difference between random module in python 2.6 and 3.2? Terry Reedy <tjreedy@udel.edu> - 2012-02-06 02:27 -0500
Re: difference between random module in python 2.6 and 3.2? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-06 08:05 +0000
Re: difference between random module in python 2.6 and 3.2? Matej Cepl <mcepl@redhat.com> - 2012-02-06 09:45 +0100
Re: difference between random module in python 2.6 and 3.2? Matej Cepl <mcepl@redhat.com> - 2012-02-06 09:57 +0100
Re: difference between random module in python 2.6 and 3.2? Tim Chase <python.list@tim.thechases.com> - 2012-02-06 13:26 -0600
Re: difference between random module in python 2.6 and 3.2? Matej Cepl <mcepl@redhat.com> - 2012-02-06 23:06 +0100
Re: difference between random module in python 2.6 and 3.2? Serhiy Storchaka <storchaka@gmail.com> - 2012-02-07 12:05 +0200
Re: difference between random module in python 2.6 and 3.2? Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-02-07 16:11 +0100
Re: difference between random module in python 2.6 and 3.2? Mel Wilson <mwilson@the-wire.com> - 2012-02-06 10:20 -0500
csiph-web