[Python-Dev] str with base

Armin Rigo arigo at tunes.org
Tue Jan 17 19:09:05 CET 2006


Hi Alex,

> Is it finally time in Python 2.5 to allow the "obvious" use of, say,
> str(5,2) to give '101', just the converse of the way int('101',1)
> gives 5?

+1.  That's obvious enough for me.  Clearly it should only work with int
and long arguments, just like int(x,base) only works if x is a str or
unicode argument (and not something that can be converted to a string,
or even a stringish type for some definition of stringish).


Armin


More information about the Python-Dev mailing list