On Jan 16, 2006, at 8:03 PM, Jeremy Hylton wrote:
It never occured to me that str() would behave like int() for this case. It makes complete sense to me that a factory for numbers would ask about the base of the number. What would the base of a string be, except in a few limited cases? str([1, 2], 4) doesn't make any sense. You might argue that I wasn't all that bright as a beginner <0.5 wink>.
I think it shouldn't be changed, because the second positional argument only works for a small number of the panoply types that can be passed to str().
Identically the same situation as for int: the base argument is only accepted if the first argument is a str (not a float, etc). Just the same way, the base argument to str will only be accepted if the first argument is an int (not a float, etc).