On 1/16/06, Alex Martelli <[EMAIL PROTECTED]> wrote: > > On Jan 16, 2006, at 8:03 PM, Jeremy Hylton wrote: > > 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).
The concept of base is closely related to ints, and the base argument is useful for a large percentage of the types that int accepts. It is not related to strings, in general, and applies to only one of the types it accepts. In one case "not a float, etc." applies to a very limited set of types, in the other case it applies to every conceivable type (except int). If str() were to take two argument, the analogy with int suggests it should be an encoding, where the second argument describes how to interpret the representation of the first (it's base 7 or it's utf-8). Jeremy _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com