[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 i

[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 i

[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'

[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 ascendin

[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

[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 l