I'm working on issue 2416, adding %b to % formatting 
(http://bugs.python.org/issue2416).  It's really quite a pain, 
especially in 2.6 with int and long and str and unicode.

I'm contemplating just making % formatting compute a new format string 
and call str.format (or obj.__format__, or something appropriate).  But 
before I proceed, I thought I'd ask and see if this really offends 
anyone.  By implementing % in terms of str.format, I hope to be able to 
delete a lot of the duplication in the formatting code, but I haven't 
checked yet to see what's possible.  The real impetus is issue 2416, though.

About the only downside I see is that str.format is somewhat slower than 
%, but I can probably get around most of this by directly calling 
int.__format__, float.__format__, etc.  Other than misleading 
microbenchmarks, I've never really compared the difference, though.     

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

Reply via email to