Tim Peters <t...@python.org> added the comment:
[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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue24567> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com