On 08.09.2016 00:41, Matt Gilson wrote:
I lurk around here a lot more than I actually post -- But in this case
I find myself weighing in firmly on the side of "please don't add
this". It'd just add noise in the documentation and __builtins__
namespace. There are millions of useful functions that /could/ be
added to the `list` object (or to the `__builtins__` namespace). It's
the job of the core dev team to decide which are the most useful for
everybody and this is one where (in my opinion) the usefulness doesn't
justify the additional clutter.
It seems like the primary argument for this is that some users would
like to have this functionality baked into an interactive session.
Maybe, it wasn't obvious (despite I thought so), but I also don't see it
in the built-ins. Another function in the "random" module would just
suffice.
But still, this is not my proposal, so I am gonna wait for what Arek
brings up.
Sven
If that's the case, then I'd like to point out that if you find
yourself wanting this in an interactive session frequently there is an
interactive startup file
<https://docs.python.org/3/tutorial/appendix.html#the-interactive-startup-file>
that you can modify so that this function will always be available to
/you/ whenever you start up an interactive session (and you can put
whatever else in there that you like as well :-).
I hope that helps.
On Wed, Sep 7, 2016 at 3:22 PM, Sven R. Kunze <srku...@mail.de
<mailto:srku...@mail.de>> wrote:
Maybe, there's a misunderstanding here and I hope I didn't waste
too much of your and my time.
Not sure where I got this from but my last status was that Arek
would like to have a "shuffled" function that does exactly what
you described. Maybe, that doesn't fit the reports description but
his pull request will tell the truth. :)
About the confusion of returning None. It's not confusing in the
sense of "o my god, I did it wrong, I need to learn it", but more,
like "I used shuffle, BECAUSE it's the only one I could find in a
hurry" and then ascertain "why the heck is there no alternative
returning the shuffled result instead of overwriting my list? I
would expect this from Python as it already provides both
alternatives for sorting".
Sven
On 08.09.2016 00:02, Tim Peters wrote:
[Sven R. Kunze <srku...@mail.de <mailto:srku...@mail.de>>]
I am not questioning experience which everyone in a team
can benefit from.
BUT experienced devs also need to recognize and respect
the fact that
younger/unexperienced developers are just better in detecting
inconsistencies and bloody work-arounds. They simply
haven't had to live
with them for so long. Experienced devs just are stuck in
a rut/are
routine-blinded: "we've done that for years", "there's no
better way".
That's the way we do it in our teams. Employing the new
guys as some sort of
inconsistency detectors. This way, they learn to find
their way around the
code base and they can improve it by doing so.
And I would never allow it in my team, to dismiss this
kind of observation
from new colleagues. It's invaluable as they will become
routine-blinded as
well.
I have been more than willing to discuss it, and I did not
close the
issue report. I did say I was opposed to it, but that's simply
because I am, and I explained there too _why_ I was opposed.
Do you have anything to say about the specific proposal? I doubt
either of us has found this meta-discussion useful. I'm still
looking
for a compelling use case. The only concrete thing anyone has
noted
in `shuffled()`'s favor so far is that sometimes they're
surprised by
the behavior of random.shuffle(list) returning None in an
interactive
shell (noted by you, and by another, and I cheerfully own up
to being
a bit surprised by that too long ago). But that's an observation
about `random.shuffle()`, not about the proposed `shuffled()`.
[...] I would be far more annoyed if, e.g.,
random.shuffle(some_million_element_list)
swamped my terminal with mountains of output.
But you readily accept this behavior for "sorted"? That
makes no sense at
all.
Of course it does. The only analogy to random.shuffle(big_list)
returning None that makes a lick of sense here is that
big_list.sort()
also returns None. IF a `shuffled()` function is introduced,
then of
course it should return its result - just like `sorted()`
returns its
result.
You can't both behaviors simultaneously, so the status
quo wins.
Indeed, the venerable status quo ;-)
Nobody said to change "shuffle".
A verbatim quote from the first message in this thread:
"Also shuffle() should return self so mutating methods
could be chained."
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org <mailto:Python-ideas@python.org>
https://mail.python.org/mailman/listinfo/python-ideas
<https://mail.python.org/mailman/listinfo/python-ideas>
Code of Conduct: http://python.org/psf/codeofconduct/
<http://python.org/psf/codeofconduct/>
--
pattern-sig.png
Matt Gilson// SOFTWARE ENGINEER
E: m...@getpattern.com <mailto:m...@getpattern.com>// P: 603.892.7736
We’re looking for beta testers. Go here
<https://www.getpattern.com/meetpattern>to sign up!
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/