[Python-checkins] r54411 - peps/trunk/pep-3112.txt
georg.brandl
python-checkins at python.org
Fri Mar 16 09:45:34 CET 2007
Author: georg.brandl
Date: Fri Mar 16 09:45:32 2007
New Revision: 54411
Modified:
peps/trunk/pep-3112.txt
Log:
Fix ReST markup wrt. literal code blocks.
Modified: peps/trunk/pep-3112.txt
==============================================================================
--- peps/trunk/pep-3112.txt (original)
+++ peps/trunk/pep-3112.txt Fri Mar 16 09:45:32 2007
@@ -23,22 +23,22 @@
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\x010円', '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\x010円'
@@ -46,12 +46,12 @@
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
More information about the Python-checkins
mailing list