On 3/29/2014 12:01 PM, Gregory P. Smith wrote:
From a 2.x-3.x compatible code standpoint the above could exist but the container class constructor would be a no-op on Python 2.
  if sys.version_info[0] == 2:
    BytesFormatter = str
  else:
    class BytesFormatter: ... def __mod__ ...

If done as a container class, the Python 2 version should implement the same restrictions on %s for numerics, and implement %b.