Fix ReST markup wrt. literal code blocks.
This commit is contained in:
parent
ad1e48dbf1
commit
92d7f773f2
12
pep-3112.txt
12
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
|
||||
|
|
Loading…
Reference in New Issue