Neil Schemenauer added the comment: Another revision of the patch, now quite close to PEP 461 as proposed. Changes from PEP 461:
- include %a - add -2 command-line flag. When enabled have %s fallback to calling PyObject_Str() and encoding to ASCII and also enable %r as alias for %a. Changes from previous patch: - remove __ascii__ special method, %s will only accept objects that implement __bytes__ or the buffer API, unless -2 command line is used - use buffer API if available - add -2 command-line option - Add prototypes for PyBytes_Format and _PyUnicode_FormatLong - improve some exception messages Reference counting in PyBytes_Format is quite hairy, could use some review. The code is nearly the same as Python 2.x stringobject.c. ---------- title: proof for concept patch for bytes formatting methods -> patch to implement %-interpolation for bytes (roughly PEP 461) Added file: http://bugs.python.org/file33516/bytes_mod_v4.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20284> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com