I've always wondered why there isn't a bin() built-in in Python.
Built-in functions already exist for converting ints to hexadecimal and
octal strings and vice versa i.e.
s = hex() and int(s, 16)
s = oct() and int(s, 8)
but no bin() function for binary strings
s = ??? and int(s, 2)
Or a new string formatting character bin() == "%b" % (i), but perhaps
not, here is no precedent for this not even in C. Like you say a new
method in a lib somewhere is more reasonable.
Mike
Talin wrote:
Mike Traynar credence.com> writes:
I've always wondered