[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

[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

[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

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

2021-03-07 Thread Christopher Barker
a while ago on this list, we had a bit of discussion about having a sequence view. It started with my more focused idea for a built in slice iterator, which I wrote up some time ago here: https://github.com/PythonCHB/islice-pep Then an even more expansive idea of a general purpose View was

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

2021-03-07 Thread Vincent Cheong
Interesting. Just to comment, Mr. Mertz is realistic in the algorithmic sense. Running time is highly affected by various factors. For example, lets just assume that an insertion sort of O(N^2) time on a quantum computer is fast enough for all kinds of task in the world. So, naturally, there

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

2021-03-07 Thread Vincent Cheong
Indeed, it's not directly related, perhaps misunderstanding, but I'm just drawing the similar idea between the two situations of not taking memory first. If you slice, you make a copy and that takes space. So, the space complexity is no longer O(1). It's just that, not that it has any direct

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

2021-03-07 Thread Vincent Cheong
Insightful! You mentioned terms like 'memory_view', and 'lazy slice'. You felt the pulse of the situation. But the most elegant thing (I had it a long time ago but you brought it up before, haha) is that you notice the downside of copies - you indicated how a lazy slice is the magic wand that

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

2021-03-07 Thread Serhiy Storchaka
06.03.21 09:52, Vincent Cheong пише: > I see. I do agree that my reply brings about that 'verbose repeated' feeling, > haha. But for the record, it's not about having something in hand now for the > future, but it's more of a paradigmatic approach to the implementation. > Python has changed for

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

2021-03-07 Thread Devin Jeanpierre
On Fri, Mar 5, 2021 at 3:23 PM Steven D'Aprano wrote: > On Fri, Mar 05, 2021 at 04:27:27PM -, Vincent Cheong wrote: > > > Currently, list.reverse() only works for an entire list. If one wants > > to reverse a section of it 'in-place', one needs to slicing which > > makes the space complexity

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

2021-03-06 Thread Vincent Cheong
Indeed, I understand. Thanks for reply. ___ 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

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

2021-03-06 Thread Paul Moore
On Sat, 6 Mar 2021 at 10:42, Vincent Cheong wrote: > > I see. > > You have coined the term exactly, partial-reverse. Nice. You have also put > forward a realistic question of 'why do we need'. Well, surely not everyone > needs it and definitely it's not urgently needed, but its just the >

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

2021-03-06 Thread Vincent Cheong
I see. You have coined the term exactly, partial-reverse. Nice. You have also put forward a realistic question of 'why do we need'. Well, surely not everyone needs it and definitely it's not urgently needed, but its just the counterintuitive incompleteness such that 'it works for a whole, but

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

2021-03-06 Thread Paul Moore
On Sat, 6 Mar 2021 at 07:52, Vincent Cheong wrote: > > So I thought, 'Why do we need to make a reversed copy to assign it to the > original part, when we can simply reverse the original part itself.' That's > the paradigm. A few points strike me here: 1. The question you asked ("why do we

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

2021-03-06 Thread Steven D'Aprano
On Sat, Mar 06, 2021 at 07:46:18AM +, David Mertz wrote: > So this "research" is inherently doomed to fail UNLESS, you do the > research not by actual raw timings, but rather in the sensible way of > profiling the specific number of operations in an abstracted way. Sorry, are you trying

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

2021-03-05 Thread Vincent Cheong
I see. I do agree that my reply brings about that 'verbose repeated' feeling, haha. But for the record, it's not about having something in hand now for the future, but it's more of a paradigmatic approach to the implementation. Python has changed for the better in terms of necessity: - map()

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

2021-03-05 Thread David Mertz
On Sat, Mar 6, 2021 at 7:07 AM David Mertz wrote: > This sounds like a very verbose repeated statement that "there may be a > use in the future." That's definitely not going to get a feature, no matter > how many times repeated. > > If this is something you actually need, write a subclass of

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

2021-03-05 Thread Vincent Cheong
[This is the revised version of the previous reply which contained mistakes] Sorry for not explaining the background of my idea. I'm involved in the research area of sorting algorithms. Reversals are part of sorting and correct me if wrong, `list.reverse()` is the fastest method to reverse an

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

2021-03-05 Thread David Mertz
This sounds like a very verbose repeated statement that "there may be a use in the future." That's definitely not going to get a feature, no matter how many times repeated. If this is something you actually need, write a subclass of list in Cython or C, and add that capability. I cannot think of

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

2021-03-05 Thread Vincent Cheong
Sorry for not explaining the background of my idea. I'm involved in the research area of sorting algorithms. Reversals are part of sorting and correct me if wrong, `list.reverse()` is the fastest method to reverse an entire list, which is also in-place. Yet, it doesn't work for a subsection of

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

2021-03-05 Thread Steven D'Aprano
On Fri, Mar 05, 2021 at 04:27:27PM -, Vincent Cheong wrote: > Currently, list.reverse() only works for an entire list. If one wants > to reverse a section of it 'in-place', one needs to slicing which > makes the space complexity no longer O(1). The space complexity of a list is not

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

2021-03-05 Thread 2QdxY4RzWzUUiLuE
On 2021-03-05 at 16:27:27 -, Vincent Cheong wrote: > Currently, list.reverse() only works for an entire list. If one wants > to reverse a section of it 'in-place', one needs to slicing which > makes the space complexity no longer O(1). One can also manually make > a loop and do the reversal