Want to meet any of these people? They are registered for PyCon
Steve Holden
steve at holdenweb.com
Mon Jan 31 18:25:59 EST 2005
Stephen Thorne wrote:
> On Mon, 31 Jan 2005 17:49:53 -0500, Steve Holden <steve at holdenweb.com> wrote:
>
>>Aahz wrote:
>>
>>>In article <ntrLd.101049$Jk5.19243 at lakeread01>,
>>>Steve Holden <steve at holdenweb.com> 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
Sorry you can't make it to Python. My even-naiver way of approaching the
problem was to use the sort utility built into Cygwin, thereby avoiding
writing any code at all.
regards
Steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Holden Web LLC +1 703 861 4237 +1 800 494 3119
More information about the Python-list
mailing list