[issue3982] support .format for bytes

Eric Smith report at bugs.python.org
Wed Mar 25 00:37:08 CET 2009


Eric Smith <eric at trueblade.com> added the comment:

> I also not fan on functions having different result type
> (format->bytes or str, it depends...).

In 3.x, str.format() and bytes.format() would be two different methods
on two different objects. I don't think there's any expectation that
they have the same return type. There's no such expectation for
str.strip() and bytes.strip() either.

Similarly, in 2.6, str.format() has a different return type than
unicode.format().

Now the builtin format() function is another issue. In 2.6 the return
type does depend on the types of the arguments. In 3.x, I'd suggest
leaving it as unicode and you won't be allowed to pass in bytes.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3982>
_______________________________________


More information about the Python-bugs-list mailing list