Author tim.peters
Recipients Serge Anuchin, mark.dickinson, pitrou, r.david.murray, rhettinger, serhiy.storchaka, skrah, steven.daprano, tim.peters, vstinner
Date 2018-06-27.00:05:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1530057946.7.0.56676864532.issue24567@psf.upfronthosting.co.za>
In-reply-to
Content
[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.
History
Date User Action Args
2018-06-27 00:05:47tim.peterssetrecipients: + tim.peters, rhettinger, mark.dickinson, pitrou, vstinner, steven.daprano, r.david.murray, skrah, serhiy.storchaka, Serge Anuchin
2018-06-27 00:05:46tim.peterssetmessageid: <1530057946.7.0.56676864532.issue24567@psf.upfronthosting.co.za>
2018-06-27 00:05:46tim.peterslinkissue24567 messages
2018-06-27 00:05:43tim.peterscreate