Too much builtins (was Re: Python's simplicity philosophy

Andrew Dalke adalke at
Wed Nov 19 00:04:42 CET 2003

Georgy Pruss:
> To me, it's very wrong that you can read any radix numbers, but can't
> print them. If str(int(s)) == s and int(str(n)) == n (with some limits), I
> see why str(n,radix) can't be symmetrical to int(s,radix).

But your objection would also be handled with a special-case function
which only took an int/long and a base and returned the string
representation for that base, no?  This could be a method or a class
method of int, or a new function in math.  What makes it special enough
to warrant being part of the string constructor?

> BTW there's no symmetry for str() and list()/tuple()/dict() etc.

There is a symmetry for str(float(s)) == s and str(complex(s)) == s.
Why shouldn't those take a base?

Well, almost symmetry.  str(float("1.1")) != "1.1"

                    dalke at

More information about the Python-list mailing list