"Johan Geldenhuys" <[EMAIL PROTECTED]> wrote > Would somebody care to explain what is happening in this process? > > def intToBin(self, x, count=8): > return "".join(map(lambda y:str((x>>y)&1), > range(count-1, -1, -1)))
"".join() turns a list into a string map() returns a list where each item is the result of applying the lambda to the range() lamda y: ..... is a function to be applied str() converts to a string x>>y shifts the bits of x right by y places 010 -> 001 & 1 bitwise ands with 1 which returns 1 if the last bit is one. put the bits together and it should be clear. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor