[New-bugs-announce] [issue39626] random choice to delegate to sample on sets
report at bugs.python.org
Thu Feb 13 07:59:45 EST 2020
New submission from Ilya Kamenshchikov <ikamenshchikov at gmail.com>:
In a few of my projects I had this (minor) pain of having to remember which collections of elements are sets and which are [list, tuple]. It causes me to double check and have random.sample(my_set, 1) in many places.
To me this is not how I think and causes friction: conceptually, I know something is a collection and I want 1 random choice from it. Having to differentiate on sequences vs sets makes my code uglier :(
This issue is similar to https://bugs.python.org/issue37708.
components: Library (Lib)
nosy: Ilya Kamenshchikov
title: random choice to delegate to sample on sets
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce