[Python-ideas] Shuffled
Steven D'Aprano
steve at pearwood.info
Tue Sep 6 02:51:24 EDT 2016
On Mon, Sep 05, 2016 at 09:34:05PM -0700, Mahmoud Hashemi wrote:
> I tend to agree with Arek. I've been bitten multiple times, including once
> yesterday, because shuffle works in place, when I really expect a
> sorted()-like behavior for a standalone function like that.
*shrug*
And if random.shuffle() returned a new list, other people would be
bitten because they expected it to be in-place. You can't please
everyone.
In any case, the tracker item I opened has already been closed by the
module maintainer Raymond Hettinger. I don't intend to pursue this, but
if anyone wishes to change his mind, you will need:
- good use-cases for the new function;
- evidence that this is common enough to justify;
- and (optional, but recommended) an actual patch.
If you (generic "you", not Mahmoud or Arek specifically) aren't
volunteering to do the work yourself, the barrier to convince somebody
else to do it is much higher.
One moderately stong piece of evidence would be if this function is
widely available in third-party libraries and other languages. That is
evidence that this is common enough that people are reinventing the
wheel, and therefore we should consider adding a standard wheel. But I
don't have the time (or that much interest) to do this, but I encourage
others to do their homework if they want to make a strong case for this
function.
--
Steve
More information about the Python-ideas
mailing list