Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'bug': 0.02; 'subject:module': 0.04; '(except': 0.05; 'versions,': 0.05; 'bug.': 0.07; 'desirable.': 0.07; 'received:verizon.net': 0.07; 'suite.': 0.07; 'terry': 0.07; 'tests,': 0.07; 'python': 0.08; 'fix.': 0.09; 'oh,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:python': 0.10; 'am,': 0.12; 'antoine': 0.16; 'docs,': 0.16; 'reedy': 0.16; 'subject:between': 0.16; 'subject:random': 0.16; 'mon,': 0.16; 'wrote:': 0.18; '>>>': 0.18; 'int': 0.18; 'slightly': 0.19; 'jan': 0.19; 'raymond': 0.21; 'header:In-Reply-To:1': 0.22; 'feb': 0.22; 'statement': 0.23; 'versions': 0.23; 'changed': 0.23; 'convenience': 0.23; 'fix': 0.25; 'expect': 0.25; 'random': 0.28; 'bugs': 0.28; 'explicit': 0.29; 'module.': 0.29; 'version.': 0.29; 'pm,': 0.29; 'broke': 0.30; 'discussion.': 0.30; 'hash': 0.30; 'seed': 0.30; 'subject:?': 0.31; 'version': 0.32; 'break': 0.32; 'changing': 0.32; 'header:User-Agent:1': 0.33; 'test': 0.34; 'header:X -Complaints-To:1': 0.34; 'steven': 0.34; 'doc': 0.34; 'identical': 0.34; 'implies': 0.34; 'to:addr:python-list': 0.35; 'received:org': 0.36; 'sequence': 0.37; 'but': 0.37; 'similar': 0.37; 'using': 0.37; 'some': 0.38; 'several': 0.38; 'think': 0.38; 'should': 0.38; 'strong': 0.39; 'change': 0.40; 'to:addr:python.org': 0.40; 'more': 0.61; 'subject': 0.61; 'plus': 0.63; 'making': 0.64; 'kept': 0.68; '-0500,': 0.84; '12:56': 0.84; 'deliberate': 0.84; 'was.': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: difference between random module in python 2.6 and 3.2? Date: Mon, 06 Feb 2012 02:27:14 -0500 References: <4f2f5081$0$29992$c3e8da3$5496439d@news.astraweb.com> <4f2f6b87$0$29992$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-74-109-121-73.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: <4f2f6b87$0$29992$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1328513256 news.xs4all.nl 6883 [2001:888:2000:d::a6]:39132 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19894 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