Re: how to find the longst element list of lists

2007-01-09 Thread Peter Otten
Steven D'Aprano wrote: > On Mon, 08 Jan 2007 13:55:40 +0100, Peter Otten wrote: > >>> The precise results depend on the version of Python you're running, the >>> amount of memory you have, other processes running, and the details of >>> what's in the list you are trying to sort. But as my test sh

Re: how to find the longst element list of lists

2007-01-08 Thread Steven D'Aprano
On Mon, 08 Jan 2007 13:55:40 +0100, Peter Otten wrote: >> The precise results depend on the version of Python you're running, the >> amount of memory you have, other processes running, and the details of >> what's in the list you are trying to sort. But as my test shows, sort has >> some overhead

Re: how to find the longst element list of lists

2007-01-08 Thread Peter Otten
Steven D'Aprano wrote: > On Sun, 07 Jan 2007 20:55:19 -0500, Dan Sommers wrote: > >> On Sun, 07 Jan 2007 22:23:22 +0100, >> "Michael M." <[EMAIL PROTECTED]> wrote: >> >>> How to find the longst element list of lists? >>> I think, t

Re: how to find the longst element list of lists

2007-01-08 Thread Steven D'Aprano
On Sun, 07 Jan 2007 20:55:19 -0500, Dan Sommers wrote: > On Sun, 07 Jan 2007 22:23:22 +0100, > "Michael M." <[EMAIL PROTECTED]> wrote: > >> How to find the longst element list of lists? >> I think, there should be an easier way then this: > >> s1

Re: how to find the longst element list of lists

2007-01-08 Thread Peter Otten
Scott David Daniels wrote: > Dan Sommers wrote: >> ... >> longest_list, longest_length = list_of_lists[ 0 ], len( longest_list >> ) for a_list in list_of_lists[ 1 : ]: >> a_length = len( a_list ) >> if a_length > longest_length: >> longest_list, longest_length =

Re: how to find the longst element list of lists

2007-01-07 Thread Steven Bethard
Scott David Daniels wrote: > Dan Sommers wrote: >> ... >> longest_list, longest_length = list_of_lists[ 0 ], len( >> longest_list ) >> for a_list in list_of_lists[ 1 : ]: >> a_length = len( a_list ) >> if a_length > longest_length: >> longest_list, longest_lengt

Re: how to find the longst element list of lists

2007-01-07 Thread Scott David Daniels
Dan Sommers wrote: > ... > longest_list, longest_length = list_of_lists[ 0 ], len( longest_list ) > for a_list in list_of_lists[ 1 : ]: > a_length = len( a_list ) > if a_length > longest_length: > longest_list, longest_length = a_list, a_length > will run faster

Re: how to find the longst element list of lists

2007-01-07 Thread Dan Sommers
On Sun, 07 Jan 2007 22:23:22 +0100, "Michael M." <[EMAIL PROTECTED]> wrote: > How to find the longst element list of lists? > I think, there should be an easier way then this: > s1 = ["q", "e", "d"] > s2 = ["a", "b"

Re: how to find the longst element list of lists

2007-01-07 Thread Michael M.
Sorry, wrong place. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to find the longst element list of lists

2007-01-07 Thread Michael M.
Bruno Desthuilliers wrote: > > Err... this makes three distinct lists, not a list of lists. > Sure. Logically spoken. Not in Python code. Or a number of lists. Sure not [[ bla... ] [bla.]] etc. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to find the longst element list of lists

2007-01-07 Thread Thomas Ploch
Michael M. schrieb: >> Err... this makes three distinct lists, not a list of lists. >> > > Sure. Logically spoken. Not in Python code. Or a number of lists. > Sure not [[ bla... ] [bla.]] etc. ??? Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: how to find the longst element list of lists

2007-01-07 Thread Michael M.
> > Err... this makes three distinct lists, not a list of lists. > Sure. Logically spoken. Not in Python code. Or a number of lists. Sure not [[ bla... ] [bla.]] etc. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to find the longst element list of lists

2007-01-07 Thread Bruno Desthuilliers
Michael M. a écrit : > How to find the longst element list of lists? For what definition of "find" ? You want the lenght of the longest sublist, it's index, or a reference to it ? > I think, there should be an easier way then this: > > s1 = ["q", "

Re: how to find the longst element list of lists

2007-01-07 Thread Jussi Salmela
Michael M. kirjoitti: > How to find the longst element list of lists? > > I think, there should be an easier way then this: > > s1 = ["q", "e", "d"] > s2 = ["a", "b"] > s3 = ["a", "b", "c&qu

how to find the longst element list of lists

2007-01-07 Thread Michael M.
How to find the longst element list of lists? I think, there should be an easier way then this: s1 = ["q", "e", "d"] s2 = ["a", "b"] s3 = ["a", "b", "c", "d"] if len(s1) >= len(s2) and

Re: how to find the longst element list of lists

2007-01-07 Thread Thomas Ploch
Michael M. schrieb: > How to find the longst element list of lists? > > I think, there should be an easier way then this: > >s1 = ["q", "e", "d"] >s2 = ["a", "b"] >s3 = ["a", "b", "

Re: how to find the longst element list of lists

2007-01-07 Thread Felipe Almeida Lessa
On 1/7/07, Michael M. <[EMAIL PROTECTED]> wrote: > How to find the longst element list of lists? s1 = ["q", "e", "d"] s2 = ["a", "b"] s3 = ["a", "b", "c", "d"] s = [s1, s2, s3] s.sort(key=len, re