On Mon, 31 Jan 2005 17:49:53 -0500, Steve Holden <[EMAIL PROTECTED]> wrote: > Aahz wrote: > > In article <[EMAIL PROTECTED]>, > > Steve Holden <[EMAIL PROTECTED]> wrote: > > > >>Note that the sort order isn't perfect - I just sorted on the second > >>"word" in each name. PyCon is a *great* place to meet people and discuss > >>ideas. Hope to see you there. > > > > > > Good thing I'm not coming this year, eh? ;-) > > If you mean specifically for sorting purposes, it would have put the > null second name at the beginning just like you'd expect.
Odd, the naive way I would have written such a script would have been: all_names = (line.split() for line in sys.stdin) sys.stdout.writelines(' '.join(x[1])+'\n' for x in sorted((name[1], name) for name in all_names)) which would not have worked correctly, it would have thrown an exception because "Aahz\n".split()[1] does not exist. I guess the second iteration would use name[1:] instead... unfortunately-not-going-to-pycon-ly y'rs. Stephen Thorne -- http://mail.python.org/mailman/listinfo/python-list