[Python-ideas] Shuffled
David Mertz
mertz at gnosis.cx
Thu Sep 8 13:32:22 EDT 2016
I also can't really get from "Arek has a need for this one line definition"
to "it should be in the standard library". Sure, 'shuffled()' is a more
obvious spelling than the slightly odd lambda. But I've yet to see the
reason that alias can't just be defined at the top of the test suite.
On Sep 8, 2016 3:14 AM, "Danilo J. S. Bellini" <danilo.bellini at gmail.com>
wrote:
> That wont work because I would have to type the expression that is used as
>> argument twice in a test.
>
> (lambda data: random.sample(data, len(data)))(container)
>
> That lambda is actually your "shuffled"...
>
> 2016-09-08 6:34 GMT-03:00 Arek Bulski <arek.bulski at gmail.com>:
>
>> > So, why can't you call random.shuffle(all_tests) if you want to run
>> your tests in random order?
>>
>> I dont randomize test order. People should stop assuming that they know
>> better. I need to randomize some arguments for one particular test and I
>> cannot call shuffle between tests. Its a continous list of declarative
>> tests. Needs to be shuffled().
>>
>> https://github.com/construct/construct/blob/master/tests/test_all.py
>> See? No way to put imperative code between tests.
>>
>> > sample(container, len(container))
>>
>> That wont work because I would have to type the expression that is used
>> as argument twice in a test. I need shuffled. Enough said.
>>
>> > I'll reiterate that I don't have a use case for this myself...
>>
>> I dont have a use case for half of what the std library offers. Or for
>> type annotations. Asynchronous comprehesions, what is that? Do you see me
>> rejecting those?
>>
>> > (sample having default of entire list size)
>>
>> That would work but would not be pretty. shuffled() is self explanatory
>> and has a nice ring to it. Randomized list is not a sample by definition.
>>
>>
>> pozdrawiam,
>> Arkadiusz Bulski
>>
>>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>
>
>
> --
> Danilo J. S. Bellini
> ---------------
> "*It is not our business to set up prohibitions, but to arrive at
> conventions.*" (R. Carnap)
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160908/a059a653/attachment.html>
More information about the Python-ideas
mailing list