[Python-checkins] r58301 - peps/trunk/pep-0000.txt peps/trunk/pep-0358.txt peps/trunk/pep-3137.txt
guido.van.rossum
python-checkins at python.org
Wed Oct 3 18:04:53 CEST 2007
Author: guido.van.rossum
Date: Wed Oct 3 18:04:53 2007
New Revision: 58301
Modified:
peps/trunk/pep-0000.txt
peps/trunk/pep-0358.txt
peps/trunk/pep-3137.txt
Log:
Mark PEP 3137 as accepted.
Mark Summerfield sent some comments on PEP 358 (I also referenced PEP 3137).
Modified: peps/trunk/pep-0000.txt
==============================================================================
--- peps/trunk/pep-0000.txt (original)
+++ peps/trunk/pep-0000.txt Wed Oct 3 18:04:53 2007
@@ -80,6 +80,7 @@
SA 3118 Revising the buffer protocol Oliphant, Banks
SA 3119 Introducing Abstract Base Classes GvR, Talin
SA 3121 Extension Module Initialization & Finalization von Löwis
+ SA 3137 Immutable Bytes and Mutable Buffer GvR
Open PEPs (under consideration)
@@ -96,7 +97,6 @@
S 3116 New I/O Stutzbach, Verdone, GvR
S 3134 Exception Chaining and Embedded Tracebacks Yee
S 3135 New Super Spealman, Delaney
- S 3137 Immutable Bytes and Mutable Buffer GvR
S 3141 A Type Hierarchy for Numbers Yasskin
Finished PEPs (done, implemented in Subversion)
@@ -510,7 +510,7 @@
S 3134 Exception Chaining and Embedded Tracebacks Yee
S 3135 New Super Spealman, Delaney
SR 3136 Labeled break and continue Chisholm
- S 3137 Immutable Bytes and Mutable Buffer GvR
+ SA 3137 Immutable Bytes and Mutable Buffer GvR
S 3141 A Type Hierarchy for Numbers Yasskin
Modified: peps/trunk/pep-0358.txt
==============================================================================
--- peps/trunk/pep-0358.txt (original)
+++ peps/trunk/pep-0358.txt Wed Oct 3 18:04:53 2007
@@ -11,6 +11,11 @@
Post-History:
+Update
+
+ This PEP has partially been superseded by PEP 3137.
+
+
Abstract
This PEP outlines the introduction of a raw bytes sequence type.
@@ -32,15 +37,15 @@
overloading of purpose leads to confusion and bugs. In future
versions of Python, string objects will be used for holding
character data. The bytes object will fulfil the role of a byte
- container. Eventually the unicode built-in will be renamed to str
- and the str object will be removed.
+ container. Eventually the unicode type will be renamed to str
+ and the old str type will be removed.
Specification
A bytes object stores a mutable sequence of integers that are in
the range 0 to 255. Unlike string objects, indexing a bytes
- object returns an integer. Assigning or comparin an object that
+ object returns an integer. Assigning or comparing an object that
is not an integer to an element causes a TypeError exception.
Assigning an element to a value outside the range 0 to 255 causes
a ValueError exception. The .__len__() method of bytes returns
@@ -58,10 +63,10 @@
(optimized for clear semantics, not for speed) is:
def bytes(initializer=0, encoding=None):
- if isinstance(initializer, int): # In 2.6, (int, long)
+ if isinstance(initializer, int): # In 2.6, int -> (int, long)
initializer = [0]*initializer
elif isinstance(initializer, basestring):
- if isinstance(initializer, unicode): # In 3.0, always
+ if isinstance(initializer, unicode): # In 3.0, "if True"
if encoding is None:
# In 3.0, raise TypeError("explicit encoding required")
encoding = sys.getdefaultencoding()
@@ -106,7 +111,7 @@
>> bytes([92, 83, 80, 255]).hex()
'5c5350ff'
- The bytes object has some methods similar to list method, and
+ The bytes object has some methods similar to list methods, and
others similar to str methods. Here is a complete list of
methods, with their approximate signatures:
@@ -176,8 +181,8 @@
support bytes objects.
* It has been suggested that a special method named .__bytes__()
- be added to language to allow objects to be converted into byte
- arrays. This decision is out of scope.
+ be added to the language to allow objects to be converted into
+ byte arrays. This decision is out of scope.
* A bytes literal of the form b"..." is also proposed. This is
the subject of PEP 3112.
@@ -236,7 +241,7 @@
A: There is no sane meaning that the encoding can have in that case.
str objects *are* byte arrays and they know nothing about the
encoding of character data they contain. We need to assume that
- the programmer has provided str object that already uses the
+ the programmer has provided a str object that already uses the
desired encoding. If you need something other than a pure copy of
the bytes then you need to first decode the string. For example:
Modified: peps/trunk/pep-3137.txt
==============================================================================
--- peps/trunk/pep-3137.txt (original)
+++ peps/trunk/pep-3137.txt Wed Oct 3 18:04:53 2007
@@ -3,7 +3,7 @@
Version: $Revision$
Last-Modified: $Date$
Author: Guido van Rossum <guido at python.org>
-Status: Draft
+Status: Accepted
Type: Standards Track
Content-Type: text/x-rst
Created: 26-Sep-2007
More information about the Python-checkins
mailing list