Problem in listbits.py (chapter 1)
Alex Kleider has highlighted a problem with the listbits() function in bitmask.py as described on pages 40/41. The function using default arguments does not print the last bit.
The corrected code should read:
def listbits(self, start=0,end=None):
if end: end = end if end < 0 else end+2
return [int(c) for c in bin(self)[start+2:end]]
I've submitted a corrected file to Wrox and hopefully it will soon appear
on the download site.
Thanks again to Alex and apologies for the slip up.
|