[Python-Dev] RFC: PEP 460: Add bytes % args and bytes.format(args) to Python 3.5
Daniel Holth
dholth at gmail.com
Tue Jan 7 15:08:57 CET 2014
+1
I have always been delighted that it is possible to manipulate binary
data in Python using string operations. It's not just immoral
non-Unicode text processing. A poor man's ASN.1 generator is an
example of a very non-text thing that might be convenient to write
with a few %s fill-in-the-blanks.
Isn't it true that if you have bytes > 127 or surrogate escapes then
encoding to latin1 is no longer as fast as memcpy?
On Tue, Jan 7, 2014 at 8:22 AM, Serhiy Storchaka <storchaka at gmail.com> wrote:
> Most popular formatting codes in Mercurial sources:
>
> 2519 %s
> 493 %d
> 102 %r
> 48 %Y
> 47 %M
> 41 %H
> 39 %S
> 38 %m
> 33 %i
> 29 %b
> 23 %ld
> 19 %ln
> 12 %.3f
> 10 %a
> 10 %.1f
> 9 %(val)r
> 9 %p
> 9 %.2f
> 8 %I
> 6 %n
> 5 %(val)s
> 5 %.0f
> 5 %02x
> 4 %f
> 4 %c
> 4 %12s
> 3 %(user)s
> 3 %(id)s
> 3 %h
> 3 %(bzdir)s
> 3 %0.2f
> 3 %02d
>
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/dholth%40gmail.com
More information about the Python-Dev
mailing list