RE: sorted (WAS: lambda)

2005-01-13 Thread Delaney, Timothy C (Timothy)
Terry Reedy wrote: > No, not same difference. A list method would only operate on lists, > as is true of all list methods. Being a function lets it work for > any iterable, as is true of any function of iterable. Big > difference. And consistent. One could argue though that it should > have be

Re: sorted (WAS: lambda)

2005-01-13 Thread Terry Reedy
"Paul Rubin" <"http://phr.cx"@NOSPAM.invalid> wrote in message news:[EMAIL PROTECTED] > Steven Bethard <[EMAIL PROTECTED]> writes: >> Note that sorted is a builtin function, not a method of a list >> object. > > Oh, same difference. I thought it was a method because I'm not using > 2.4 yet. The

Re: sorted (WAS: lambda)

2005-01-13 Thread Paul Rubin
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > > Oh, same difference. I thought it was a method because I'm not using > > 2.4 yet. The result is the same > > nope. sorted works on any kind of sequence, including forward-only > iterators. sorted(open(filename)) works just fine, for example. Oh

Re: sorted (WAS: lambda)

2005-01-13 Thread Fredrik Lundh
Paul Rubin wrote: >> Note that sorted is a builtin function, not a method of a list >> object. > > Oh, same difference. I thought it was a method because I'm not using > 2.4 yet. The result is the same nope. sorted works on any kind of sequence, including forward-only iterators. sorted(open(f

sorted (WAS: lambda)

2005-01-13 Thread Steven Bethard
Paul Rubin wrote: That completely depends on the objects in question. Compare temp = all_posters[:] temp.sort() top_five_posters = temp[-5:] to: top_five_posters = all_posters.sorted()[-5:] which became possible only when .sorted() was added to Python 2.4. I believe you mean "when sort

Re: sorted (WAS: lambda)

2005-01-13 Thread Paul Rubin
Steven Bethard <[EMAIL PROTECTED]> writes: > Note that sorted is a builtin function, not a method of a list > object. Oh, same difference. I thought it was a method because I'm not using 2.4 yet. The result is the same, other than that having it as a function instead of a method is another incon