list.sort, was Re: [Python-Dev] decorate-sort-undecorate
Holger Krekel
pyth at devel.trillke.net
Fri Oct 17 16:49:24 EDT 2003
More information about the Python-Dev mailing list
Fri Oct 17 16:49:24 EDT 2003
- Previous message: list.sort, was Re: [Python-Dev] decorate-sort-undecorate
- Next message: list.sort, was Re: [Python-Dev] decorate-sort-undecorate
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Gustavo Niemeyer wrote:
> > If anything at all, i'd suggest a std-module which contains e.g.
> > 'sort', 'reverse' and 'extend' functions which always return
> > a new list, so that you could write:
> >
> > for i in reverse(somelist):
> > ...
>
> You can do reverse with [::-1] now.
sure, but it's a bit unintuitive and i mentioned not only reverse :-)
Actually i think that 'reverse', 'sort' and 'extend' algorithms
could nicely be put into the new itertools module.
There it's obvious that they wouldn't mutate objects. And these algorithms
(especially extend and reverse) would be very efficient as iterators because
they wouldn't create temporary lists/tuples.
cheers,
holger
- Previous message: list.sort, was Re: [Python-Dev] decorate-sort-undecorate
- Next message: list.sort, was Re: [Python-Dev] decorate-sort-undecorate
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list