Jack Diederich <[EMAIL PROTECTED]> writes:

> > However... if %b were to represent arbitrary bases, I think that's  
> > backwards.  It should be %[<pad>][.<base>]b, which would do this:
> > 
> >     >>> '%08b %08o %08d %08x' % 12
> >     '00001100 00000014 00000012 0000000C'
> > 
> 
> Were I BDFAD (not to be confused with BD-FOAD) I'd add %b, %B and, binary()
> to match %x, %X, and hex().  The arbitrary base case isn't even academic
> or we would see homework questions about it on c.l.py.  No one asks about
> hex or octal because they are there.  No one asks about base seven
> formatting because everyone knows numerologists prefer Perl.

BTW, Perl already do binary literals and %b formatting so there is
some precedence for it:

  $ perl -e '$a = 0b1100; printf "%08b %08o %08d %08x\n", $a, $a, $a, $a'
  00001100 00000014 00000012 0000000c  

--Gisle
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to