(original) (raw)

On 1/16/2014 8:41 AM, Brett Cannon wrote:
That's a very good catch, Michael! I think that makes sense if there is precedence. Unfortunately that bit from the PEP never made it into the documentation so I'm not sure if there is a backwards-compatibility worry.

No. If \_\_format\_\_ is called with bytes format, and returns str, there would be an exception generated on the spot.

If \_\_format\_\_ is called with bytes format, and tries to use it as str, there would be an exception generated on the spot.

Prior to 3.whenever-this-is-implemented, Python 3 only provides str formats to \_\_format\_\_, right? So new code is required to pass bytes to \_\_format\_\_.