[issue39626] random choice to delegate to sample on sets

Raymond Hettinger report at bugs.python.org
Thu Feb 13 20:37:27 EST 2020


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

Thanks for the suggestion.  I think this is close to being a duplicate of 37708 which was rejected.  For the most part, it was mistake that sample() accepted sets.  The implicit conversion has led to surprising performance issues.  If that API was being created from scratch, it would not support sets at and would require the user to explicitly convert to a sequence.  I do not wish to replicate this mistake with choices().

As for delegating to sample(), that doesn't make sense because choices() works with replacement and sample() works without replacement.  The two are semantically different.

----------
assignee:  -> rhettinger
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39626>
_______________________________________


More information about the Python-bugs-list mailing list