On Mon, 23 Jan 2006 03:21:59 +0100, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > >BTW: What is the shortest way to get the binary representation of a >number in Python? Is there really not something like itoa() anywhere in >the standard libs?
I'm somewhat partial to this implementation: binary = lambda i,c = (lambda i,c: i and (c(i>>1, c) + str(i&1)) or ''): c(i,c) Although I won't claim it is the best solution. Fortunately for you, I guess, it looks like Python 2.5 will have either a bin() builtin or a '%b' format character or something like that in order to do this. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list