Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #85967

Re: What behavior would you expect?

Date 2015-02-20 08:07 -0500
From Dave Angel <davea@davea.name>
Subject Re: What behavior would you expect?
References (1 earlier) <CANy1k1gMgGnqNcgTwjcqfYH-QctZthv89uXcU8SV9Uk6Wji=4A@mail.gmail.com> <CAPTjJmpeYwsQ=XLu5WicVEnqMZpvKJueZRrM9WGafcEm1BFatg@mail.gmail.com> <CANy1k1j8ni7TtZPq_a2r8TUvY13rh0oY8xt-t6+9KPxwfAYEyw@mail.gmail.com> <CAPTjJmpq3t4qb+VD+uL6w+=_wf5v0BFThYFM+a8JAe2RDXpTYg@mail.gmail.com> <CANy1k1j+_boVW4EP=fijUKFVRctzD8EETm3kZ==eoezA=S=a6Q@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.18919.1424437670.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 02/20/2015 12:51 AM, Jason Friedman wrote:
>>
>> I'd still advise using my_list.sort() rather than sorted(), as you
>> don't need to retain the original.
>>
>>
> Hmm.
>
> Trying to figure out what that looks like.
> If I understand correctly, list.sort() returns None.
> What would I return to the caller?
>

     return_list = ....
     return_list.sort(key=..., reverse = True)
     return return_list

>
> Oops, guess I'm not really returning a list, I'm returning an iterator.

Now you'll be returning a list, I believe.


-- 
DaveA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: What behavior would you expect? Dave Angel <davea@davea.name> - 2015-02-20 08:07 -0500

csiph-web