Jonathan Fine writes:
> tmp = list(sorted(d.items()))
The list() call is redundant. sorted() always returns a new list.
Ditto, reversed(). The method versions are in-place.
Steve
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscrib
On Sun, May 30, 2021 at 5:18 PM Stephen J. Turnbull
wrote:
>
> Jonathan Fine writes:
>
> > tmp = list(sorted(d.items()))
>
> The list() call is redundant. sorted() always returns a new list.
Correct.
> Ditto, reversed(). The method versions are in-place.
Not correct - reversed() is a paralle
Chris Angelico writes:
> > Ditto, reversed(). The method versions are in-place.
>
> Not correct - reversed() is a parallel to iter() and returns a
> reversed iterator.
Opps, I knew that too -- once upon a time. Thanks for the correction!
___
Pyt
On Mon, May 31, 2021 at 12:19 AM Stephen J. Turnbull
wrote:
>
> Chris Angelico writes:
>
> > > Ditto, reversed(). The method versions are in-place.
> >
> > Not correct - reversed() is a parallel to iter() and returns a
> > reversed iterator.
>
> Opps, I knew that too -- once upon a time. Tha