On Thu, Dec 15, 2011 at 9:57 AM, John Gordon <gor...@panix.com> wrote:
> In <61edc02c-4f86-45ef-82a1-61c701300...@t38g2000yqe.googlegroups.com> > noydb <jenn.du...@gmail.com> writes: > > > My sort issue... as in this doesn't work > > >>> if x.sort =3D=3D y.sort: > > ... print 'equal' > > ... else: > > ... print 'not equal' > > ... > > not equal > > > ??? > > Use x.sort() instead of x.sort . > And you cannot use the method in-line - it mutates the list in place, returning None. If you either do not wish to mutate the list, or you absolutely want to do the sort in-line, you need to use the sorted built-in: if sorted(x) == sorted(y): ... However, this will, temporary, use double the memory. > > -- > John Gordon A is for Amy, who fell down the stairs > gor...@panix.com B is for Basil, assaulted by bears > -- Edward Gorey, "The Gashlycrumb Tinies" > > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list