Message366919
Raymond:
> Also, I don't want randbytes() in the C extension. We're tried to keep as much of the code as possible in pure Python and only have the MersenneTwister specific code in the C module. The improves maintainability and makes the code more accessible to a broader audience.
I don't see how 30 lines makes Python so harder to maintain. These lines make the function 4x to 5x faster. We are not talking about 5% or 10% faster. I think that such optimization is worth it. When did we decide to stop optimizing Python?
Raymond:
> The randbytes() method needs to depend on genrandbits().
I created bpo-40346: "Redesign random.Random class inheritance" for a more generic fix, not just randbytes().
Raymond:
> Also, please don't change the name of the genrand_int32() function. It was a goal to change as little as possible from the official, standard version of the C code at http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html .
This code was already modified to replace "unsigned long" with "uint32_t" for example. I don't think that renaming genrand_int32() to genrand_uint32() makes the code impossible to maintain. Moreover, it seems like http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html was not updated for 13 years. |
|
Date |
User |
Action |
Args |
2020-04-21 12:49:42 | vstinner | set | recipients:
+ vstinner, tim.peters, rhettinger, mark.dickinson, serhiy.storchaka, veky |
2020-04-21 12:49:42 | vstinner | set | messageid: <1587473382.16.0.228487949326.issue40286@roundup.psfhosted.org> |
2020-04-21 12:49:42 | vstinner | link | issue40286 messages |
2020-04-21 12:49:41 | vstinner | create | |
|