That makes more sense than a builtin. Note that oct() and hex() return
something that's a valid Python literal. There are no binary literals
(nor should there be IMO).
On 4/22/06, Nick Coghlan <[EMAIL PROTECTED]> wrote:
> Ian Bicking wrote:
> > Guido van Rossum wrote:
> >> This has been brought up
Ian Bicking wrote:
> Guido van Rossum wrote:
>> This has been brought up many times before. The value of bin() is
>> really rather minimal except when you're just learning about binary
>> numbers; and then writing it yourself is a useful exercise.
>>
>> I'm not saying that bin() is useless -- but I
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 why there isn't a
Mike Traynar credence.com> writes:
> 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.
Perhaps a "format_base" function in the strings library, that takes an
int and a n
Guido van Rossum wrote:
> This has been brought up many times before. The value of bin() is
> really rather minimal except when you're just learning about binary
> numbers; and then writing it yourself is a useful exercise.
>
> I'm not saying that bin() is useless -- but IMO its (small) value
> do
This has been brought up many times before. The value of bin() is
really rather minimal except when you're just learning about binary
numbers; and then writing it yourself is a useful exercise.
I'm not saying that bin() is useless -- but IMO its (small) value
doesn't warrant making, maintaining an
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)