On 07.09.2016 02:49, Chris Kaynor
wrote:
That sounds extremely familiar. I would say the interactive session
is the clear use-case here. But don't ask me why I need a shuffled
list of somethings (probably for some highly vicious and immoral
reasons ;-) ).
@David
Your idea of a PyPI package could almost work. However, in an
interactive python console, I expect as much batteries included as
possible to make it as quick as possible. And considering how simple
such wrapper would be, it almost does not warrant the download of a
third-party package.
@Tim
Of course it's easy to write a wrapper function. But from what I
gather here, this is not the point. In interactive sessions, I find
it highly annoying when I need to define my own functions.
Especially because I need to do it again in a new python session.
Somebody provided a one-line hack using "sorted" to emulate
"shuffled". The statement basically is: shuffling is a special kind
of sorting. So, I would expect the interface to work the same. That
at least suffices for me to understand Arek's point of view.
I would even go so far as to say:
shuffled(my_list) # returns a new shuffled list
my_list.shuffle() # shuffles in-place
Allowing to plug-in the RNG, when needed.
Sven