From 92d7f773f2a331def644e52e9dd9ed95293c9bf5 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 16 Mar 2007 08:45:32 +0000 Subject: [PATCH] Fix ReST markup wrt. literal code blocks. --- pep-3112.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pep-3112.txt b/pep-3112.txt index 8d23d428d..a79decceb 100644 --- a/pep-3112.txt +++ b/pep-3112.txt @@ -23,22 +23,22 @@ spell ASCII strings and arbitrary binary data. Motivation ========== -Existing spellings of an ASCII string in Python 3000 include: +Existing spellings of an ASCII string in Python 3000 include:: bytes('Hello world', 'ascii') 'Hello world'.encode('ascii') -The proposed syntax is: +The proposed syntax is:: b'Hello world' -Existing spellings of an 8-bit binary sequence in Python 3000 include: +Existing spellings of an 8-bit binary sequence in Python 3000 include:: bytes([0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x00]) bytes('\x7fELF\x01\x01\x01\0', 'latin-1') '7f454c4601010100'.decode('hex') -The proposed syntax is: +The proposed syntax is:: b'\x7f\x45\x4c\x46\x01\x01\x01\x00' b'\x7fELF\x01\x01\x01\0' @@ -46,12 +46,12 @@ The proposed syntax is: In both cases, the advantages of the new syntax are brevity, some small efficiency gain, and the detection of encoding errors at compile time rather than at runtime. The brevity benefit is especially felt -when using the string-like methods of bytes objects: +when using the string-like methods of bytes objects:: lines = bdata.split(bytes('\n', 'ascii')) # existing syntax lines = bdata.split(b'\n') # proposed syntax -And when converting code from Python 2.x to Python 3000: +And when converting code from Python 2.x to Python 3000:: sok.send('EXIT\r\n') # Python 2.x sok.send('EXIT\r\n'.encode('ascii')) # Python 3000 existing