"Peter Hansen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What did you expect the "length" of the integer 3 to be?
Perhaps 2 (bits in a minimal binary representation). I once, for maybe a minute, considered proposing this as an overloaded meaning of len, but realized that that would more often mask errors than save time. If case bits(i) is what the OP wants: def bits(i): i = abs(i) b = 0 while i: i >>= 1 b += 1 return b Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list