[Tutor] Explanation of this lambda

Johan Geldenhuys johan at accesstel.co.za
Thu Feb 22 06:54:30 CET 2007

Hi all,
I found this function that converts a integer into a 8 bit binary string. 
Would somebody care to explain what is happening in this process? 
def intToBin(self, x, count=8):
        Parameters: `x`: integer
        Returns a 8 bit binary string of x
        return "".join(map(lambda y:str((x>>y)&1), range(count-1, -1, -1)))


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.3/694 - Release Date: 2007/02/20
01:44 PM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070222/f0416ace/attachment.htm 

More information about the Tutor mailing list