[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] Basic toolkit for async iterators

2021-03-07 Thread Sam Frances
Apologies if this has already been raised at some point, but I wanted to raise the idea of a basic standard library toolkit for operations on async iterators. This would include versions of functions that are already in the standard library for non-async iterators, such as *map*, *filter*,*zip

[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