Re: int <-> str asymmetric

2006-03-16 Thread Steven Bethard
Schüle Daniel wrote: > however we lack the reverse functionality > the logical > > >>> str(10,2) > Traceback (most recent call last): > File "", line 1, in ? > TypeError: str() takes at most 1 argument (2 given) > >>> > > fails > > it would not break anything if str interface would be change

int <-> str asymmetric

2006-03-16 Thread Schüle Daniel
Hello what I sometimes miss in Python is the possibility to switch tha base of a number for example this is how it's done in Ruby irb(main):099:0* a = 10.to_s(2) => "1010" irb(main):100:0> a.to_i(2) => 10 irb(main):101:0> irb(main):102:0* a = 10.to_s(3) => "101" irb(main):103:0> a.to_i(3) => 10