difference between random module in python 2.6 and 3.2?

Tim Chase python.list at tim.thechases.com
Mon Feb 6 14:26:42 EST 2012


On 02/06/12 12:48, Aaron France wrote:
> On 02/06/2012 09:57 AM, Matej Cepl wrote:
>> Silly, of course, the solution is obvious ... I have just
>> embedded random.choice from 2.6 to my code.
>>
>> Matěj
> Is the above actually a good idea though?
>
> What I understand you're doing is embedding the source from
> the Python2.6 random.py file, /into/ your project files?

In an ideal world, the code wouldn't have broken backwards 
compat.  However, given the conditions, if Matej is willing to 
forgo bug-fixes, it's a reasonable solution.  The alternate might 
be to try moving the recent/fixed version into the old project 
and updating tests/data to work with it.  I have some 2.4 
production code in which I've pulled 2.6's zipfile module in to 
give access to the iterator access (rather than the .read() 
method which tries to read in umpteen gigs of data that I just 
want to spool out to a file on disk).

-tkc





More information about the Python-list mailing list