[Python-ideas] Shuffled
Steven D'Aprano
steve at pearwood.info
Thu Sep 8 07:47:40 EDT 2016
This thread is just going around and around in circles, so I will make
one final response and then I'm going to bow out.
On Thu, Sep 08, 2016 at 11:34:57AM +0200, Arek Bulski wrote:
> Needs to be shuffled().
>
> https://github.com/construct/construct/blob/master/tests/test_all.py
> See? No way to put imperative code between tests.
>
> I need shuffled. Enough said.
Okay, okay. Suppose you convince us. You complain and stamp your feet
and demand and insist and repeat "I need shuffled" ten thousand times
until you wear down everyone and they give in. With the 3.6 feature
freeze just a few days away, this new code is going into 3.7, which
probably won't reach a stable version until March or April 2018.
So what happens between now and then?
I see that your package Construct supports Python versions 2.6, 2.7,
3.3, 3.4 and 3.5. Are you ready to abandon ALL of those and support only
3.7 and higher?
If not, then you can't even use the std lib implementation of shuffled()
**because it won't exist**. At best you can test for a std lib
implementation, falling back to your own when it doesn't exist.
So you have to write your own implementation regardless of what the std
lib does. You cannot rely on the std lib version until you've dropped
support for Python 3.6, which you haven't even got support for yet! If
you support just *three* releases, the current release plus the two
previous, you won't be able to rely on the std lib shuffled() until
Python 3.9 comes out, which will probably be in 2021.
Maybe you do need shuffled(). But you can't use the one in the std lib
until (probably) 2021 or later. What are you going to do for the next
five years?
- Do without. Then you don't really need it.
- Write your own. Then you don't need it to be in the std lib.
Adding new functions to the std lib now is an investment for future
code, not a necessity for current, existing code. If you need this
shuffled function now, you know how to write it. Harsh, but true.
--
Steve
More information about the Python-ideas
mailing list