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 but that is even slower than slicing. List.reverse() does not t
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 b
On Wed, 3 Mar 2021 at 23:59, Brendan Barnwell wrote:
> But usually you want to define it at the beginning as a sort of
> documentation aid ("this is the public API").
This is a little off-topic, but I'm curious, since usually, for public
functions and classes, I do
__all__ = (Class.__name__, fu
> __all__ = (Class.__name__, func.__name__, ...)
>
> So I have to put it at the end of the module. I do this because if I
> change the class or function name and I forget to change it in
> __all__, I get an exception.
I certainly will not claim to be the arbitrator of good and bad practices
but th
On 3/5/21 12:41 PM, Caleb Donovick wrote:
> __all__ = (Class.__name__, func.__name__, ...)
>
> So I have to put it at the end of the module. I do this because if I
> change the class or function name and I forget to change it in
> __all__, I get an exception.
I certainly will not claim to
On Sat, Mar 6, 2021 at 9:47 AM Ethan Furman wrote:
>
> On 3/5/21 12:41 PM, Caleb Donovick wrote:
> >
> > > __all__ = (Class.__name__, func.__name__, ...)
> > >
> > > So I have to put it at the end of the module. I do this because if I
> > > change the class or function name and I forget to cha
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 constant
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 i
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 a
[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 en
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 list
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() re
12 matches
Mail list logo