[Python-ideas] Re: Make list.reverse() more flexible

2021-03-08 Thread Vincent Cheong
Indeed, from previous replies, I have already learnt that use-cases are the 
primary driver here around. In fact that should be the general case.

I do admit that my assessment is too abstractive for any feasible 
considerations. I was looking at it from the algorithmic sense, that if a 
function is performant then a handful if not many problems, discovered or 
undiscovered, would have been avoided through efficiency. For a little 
instance, we have the efficient BWT algorithm, life before it was normal and 
progressing, but with it data compression improved. It wasn't needed, but with 
it we improved. This is just the line of thought, hehe.

Just for comment, now that you have outlined a more conditioned judgement as to 
how good an idea is, I would like to say that it does improve performance - 
maybe a little bit of time, but space is a sure.  Does it improve coding, well, 
if the notations remain the same, then no change, if a different semantic is 
introduced, then it depends. Useful - ah, relates to above, relates to what 
many have already from before. The Zen is the wisest: since practicality beats 
purity, a function is only worth used when its code-friendly and readable, 
which points out that it heavily depends on the semantics we come up with. I 
think how useful it is realistically how simple it is to read it and code it. I 
guess it's just semantics!

Thanks for the feedback!
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/BJX77YQ3QJWHN4PFKEATD5MBHCHXWSAL/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Make list.reverse() more flexible

2021-03-08 Thread Christopher Barker
On Mon, Mar 8, 2021 at 1:24 AM Vincent Cheong wrote:
>  Indeed, if one puts on a perspective glasses of 'use-cases', it's
obvious that there is no urgency, no real-time necessity for that. We can
see that there is growing interest, but just my opinion, the more deserving
point is that it exhibits intelligence and power.

As the zen says: “practically beats purity”

I can’t speak for everyone, but I think use cases are the primary driver to
adding anything to. Python. That is, in order to add something, it needs to
be:

A) useful
And
B) provide an easier/clearer way to write to code and/or significantly
improve performance.

“Exhibiting intelligence and power” is not enough.

-CHB

-- 
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/4YHGJIQLWQ342J3FBXS4OGNMIPB4DZOA/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Make list.reverse() more flexible

2021-03-08 Thread Vincent Cheong
Indeed, making a slice a view does pose painful challenges. For a slice 
iterator, I wonder if there is an bigger overhead in being an iterator or 
building an iterator. I wholeheartedly agree that 'adding add-hoc 
functionality' is slightly toy-ish, but I brought up the idea of 'start' and 
'stop' parameters because I believed that mentioning just these two things 
themselves are humbly adequately below that 'troublesome' or 'complex' line. 
Yes, Numpy's slice is a view and that is memory efficient. Memory_view, 
lazy_slice, View_object, and other terms, quite an expansive room of 
considerations.

For discussions-sake, I would like to comment about: 'Frankly, I didn't see 
a lot of use-cases at the time -- but now it seems that we have some more, and 
some more interest.'.  Indeed, if one puts on a perspective glasses of 
'use-cases', it's obvious that there is no urgency, no real-time necessity for 
that. We can see that there is growing interest, but just my opinion, the more 
deserving point is that it exhibits intelligence and power. Intelligence 
because a users gets to choose what to do with that sublist 'before' it takes 
memory - it's intelligent not to use resources unless explicitly told to, like 
a generator. Power because if I can 'specify' that section of a list without 
making a copy, I'm effectively achieving the same thing as many would using 
for-loop + range() + indices. It has that tiny little conceptual resemblance to 
how reversed() being much better than for-loop + range() + negative_indices, 
when iterating backwards.

I'm schooled by how there was a history archive on this. Thanks for the links.

Thanks for the input.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/AJNG4C6QJ372HO3UKVT63HJXAPFKWX6P/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: OT: Make list.reverse() more flexible

2021-03-08 Thread Steven D'Aprano
On Mon, Mar 08, 2021 at 04:59:26PM +0900, Stephen J. Turnbull wrote:

> I'm curious: Many of the sorting algorithms I know use swap pairs of
> elements, but what sorting algorithm reverses segments longer than 3?

I have a feeling that Timsort may do that --- I believe it looks for 
either ascending or descending runs, sorts them, and reverses them if 
necessary.

Of course I may be wrong.


-- 
Steve
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/DBGL775O5DZ3QU57TO3R4YDS4SLX7FRW/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: OT: Make list.reverse() more flexible

2021-03-08 Thread Vincent Cheong
Depends on the implementation. If you, instead of swapping pair by pair one by 
one, rewrite that sequence in the opposite direction and that sequence is 
longer than 3, it already fits the situation. A block swap algorithm swaps two 
elements of an array. If out-of-place, you can specify more than 3 items, and 
you would have been doing that.

Thanks.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/BPF7DCQIRCGP37LIZ3J5S2WC4QEULY3G/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] OT: Make list.reverse() more flexible

2021-03-08 Thread Stephen J. Turnbull
Vincent Cheong writes:

 > Sorry for not explaining the background of my idea. I'm involved in
 > the research area of sorting algorithms.  Reversals are part of
 > sorting

I'm curious: Many of the sorting algorithms I know use swap pairs of
elements, but what sorting algorithm reverses segments longer than 3?

___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/7J3W2XAGO4ST3Z3QN2YAQBLCCOCPBW46/
Code of Conduct: http://python.org/psf/codeofconduct/