On Fri, 09 Mar 2007 18:57:42 -0300, Gabriel Genellina wrote: > En Fri, 09 Mar 2007 17:15:44 -0300, Paulo da Silva > <[EMAIL PROTECTED]> escribió: > >> What is the best way to have something like the bisect_left >> method on a list of lists being the comparision based on an >> specified arbitrary i_th element of each list element? >> >> Is there, for lists, something equivalent to the __cmp__ function for >> classes? > > lists *are* classes (at least since Python 2.2)
Not quite. Classes and types are *almost* the same, but not exactly. >>> type(list) <type 'type'> >>> class Spam: ... pass ... >>> type(Spam) <type 'classobj'> Usually the difference doesn't make a difference, but sometimes it does. >>> Spam.x = 3 >>> list.x = 3 Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: can't set attributes of built-in/extension type 'list' -- Steven. -- http://mail.python.org/mailman/listinfo/python-list