On Wed, Sep 07, 2016 at 11:47:49PM -0300, Danilo J. S. Bellini wrote:
> Though I agree with the argument that inexperienced developers are
> [usually] worse, that's not the case here, unless anyone here is really
> trying to say the ones arguing for or against "shuffled" are inexperienced.
> These ad hominem won't bring us anywhere.

That is not what I said. Please be careful of accusing others of things 
they didn't say.

It was Sven who made the claim that inexperienced developers are better 
at seeing inconsistancies. I was responding specifically to that claim. 
I'm not saying anything about the experience, or lack of, of either Sven 
or Arek.


> No one seem to be arguing if "shuffled" is inconsistent, but the "shuffle"
> consistency is a subject that didn't reach consensus. And the point now
> seem to be whether "shuffled" is useful or not. If I understood correctly,
> that proposal is about writing code in a more functional style (or a
> expression-oriented programming style), with a pure function for shuffling.
> 
> I think there are other related subjects that can be said about
> sorted/shuffled. For example: why a list? Why not a generator? 

You cannot sort a sequence lazily. You have to sort the entire sequence 
before you can be sure which item comes first. Making sorted() an 
iterator by default doesn't give you any advantage: it still has to 
sort the entire sequence before it can yield the first item.


> Something
> like random.choice is useful to get one single value, but if one just want
> to see a few random values from a large input without repeating the values,
> what's the best approach?

random.sample()

 
> Does that mean you expect Python to provide appended() [...] extended()
> > [...]
> >
> Doesn't the "+" operator do that?

Of course it does. But the "consistency" argument would be "why is 
append a method not an operator? Why isn't + called appended?".

That's just spelling. It isn't that important.


> > [...] list.cleared()?
> 
> Huh? OP is clearly talking about avoiding state, avoiding "in-place"
> operations. A clear list would be an empty list [].

Of course. We can see that. But again, that's "inconsistent":

* the in-place operation is spelled `list.clear()`

* the functional operation is spelled `[]`

There is nothing wrong with that. The value of consistency is grossly 
exaggerated. Sometimes it really doesn't matter if similar operations 
are spelled differently.



-- 
Steve
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to