Victor Stinner, 06.01.2014 14:24:
> Abstract
> ========
> Add ``bytes % args`` operator and ``bytes.format(args)`` method to
> Python 3.5.

Here is a counterproposal. Let someone who needs this feature write a
library that does byte string formatting. That properly handles it, a full
featured tool set. Write it in Cython if you need raw speed, that will also
help in making it run in both Python 2 and Python 3, or in providing easy
integration with buffers like the array module, various byte containers,
NumPy, etc.

I'm confident that this will show that the current Py2 code that
(legitimately) does byte string formatting can actually be improved,
simplified or sped up, at least in some corners. I'm sure Py2 byte string
formatting wasn't perfect for this use case either, it just happened to be
there, so everyone used it and worked around its particular quirks for the
particular use case at hand. (Think of "%s" % some_unicode_value, for example.)

Instead of waiting for 3.5, a third party library allows users to get
started porting their code earlier, and to make it work unchanged with
Python versions before 3.5.

Stefan


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to