Re: [Python-3000] New built-in function: bin()

2006-04-22 Thread Guido van Rossum
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

Re: [Python-3000] New built-in function: bin()

2006-04-22 Thread Nick Coghlan
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

Re: [Python-3000] New built-in function: bin()

2006-04-21 Thread Mike Traynar
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

Re: [Python-3000] New built-in function: bin()

2006-04-21 Thread Talin
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

Re: [Python-3000] New built-in function: bin()

2006-04-21 Thread Ian Bicking
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

Re: [Python-3000] New built-in function: bin()

2006-04-21 Thread Guido van Rossum
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

[Python-3000] New built-in function: bin()

2006-04-21 Thread Mike Traynar
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)