Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Loopup



  Python Patterns - An Optimization Anecdote

The other day, a friend asked me a seemingly simple question: what's the best way to convert a list of integers into a string, presuming that the integers are ASCII values. For instance, the list [97, 98, 99] should be converted to the string 'abc'. Let's assume we want to write a function to do this. The first version I came up with was totally straightforward: def f1(list): string = "" for item in list: string = string + chr(item) return string ...

   Python,Optimization,Anecdote,Loopup,ASCII     2011-12-18 10:52:49