Message320526
[Victor]
> This method [shuffle()] has a weird API. What is
> the point of passing a random function,
> ... I proposed to deprecate this argument and remove it later.
I don't care here. This is a bug report. Making backward-incompatible API changes does nothing to repair existing programs.
> ...
> return [population[_min(_int(random() * total), total)]
> for i in range(k)]
>
> Why not using _randbelow() here? For speed
Yup.
> Why not optimizing _randbelow() in this case? Like
> implementing it in C?
This is a bug report, not an invitation to redesign APIs and complicate implementations in non-trivial ways. If you're keen on that, I suggest opening a different issue and writing the patch.
I'd personally oppose the API change (pointless thrashing), but it's possible the speed benefit of C acceleration of _randbelow() would outweigh the considerable downsides of moving code from Python source to C source.
But none of that is needed to "fix the bug" at hand, if - indeed - people still think it's worth fixing at all. In the years that have passed since this started, I no longer do. |
|
Date |
User |
Action |
Args |
2018-06-27 00:05:47 | tim.peters | set | recipients:
+ tim.peters, rhettinger, mark.dickinson, pitrou, vstinner, steven.daprano, r.david.murray, skrah, serhiy.storchaka, Serge Anuchin |
2018-06-27 00:05:46 | tim.peters | set | messageid: <1530057946.7.0.56676864532.issue24567@psf.upfronthosting.co.za> |
2018-06-27 00:05:46 | tim.peters | link | issue24567 messages |
2018-06-27 00:05:43 | tim.peters | create | |
|