[Python-checkins] r42392 - peps/trunk/pep-0357.txt

guido.van.rossum python-checkins at python.org
Thu Feb 16 00:26:08 CET 2006


Author: guido.van.rossum
Date: Thu Feb 16 00:26:08 2006
New Revision: 42392

Modified:
   peps/trunk/pep-0357.txt
Log:
Small patch by Travis, who write:

1) fixes typo

2) Adds link to name discussion

3) Suggests adding __index__ slot to integer and long built ins.  I
   neglected to do this for the patch, but it could really simplify
   much code to have it.


Modified: peps/trunk/pep-0357.txt
==============================================================================
--- peps/trunk/pep-0357.txt	(original)
+++ peps/trunk/pep-0357.txt	Thu Feb 16 00:26:08 2006
@@ -67,7 +67,7 @@
 
     3) A new C-API function PyNumber_Index will be added with signature
 
-       Py_ssize_t PyNumber_index (PyObject *obj)
+       Py_ssize_t PyNumber_Index (PyObject *obj)
 
        which will special-case integer and long integer objects but otherwise
        return obj->ob_type->tp_as_number->nb_index(obj) if it is available. 
@@ -92,10 +92,12 @@
        slots for subscript access and use a special-check for integers to 
        check for the slot as well.
 
-    5) Add PyNumber_Index C-API to return an integer from any 
+    5) Add the nb_index slot to integers and long_integers.
+
+    6) Add PyNumber_Index C-API to return an integer from any 
        Python Object that has the nb_index slot.  
 
-    6) Add the operator.index(x) function.
+    7) Add the operator.index(x) function.
 
 
 Possible Concerns
@@ -124,7 +126,10 @@
     can be used any time Python requires an integer internally (such
     as in "mystring" * 3).  The name was suggested by Guido because
     slicing syntax is the biggest reason for having such a slot and 
-    in the end no better name emerged.
+    in the end no better name emerged. See the discussion thread:
+    http://mail.python.org/pipermail/python-dev/2006-February/thread.html#60594 
+    for examples of names that were suggested such as "__discrete__" and 
+    "__ordinal__".
 
     Why return Py_ssize_t from nb_index?  
 
@@ -136,7 +141,8 @@
 
 Reference Implementation
  
-    Submitted as patch 1429591 to SourceForge.
+    Submitted as patch 1429591 to SourceForge.  This patch number does
+    not contain implementation 5.
 
 Copyright
 


More information about the Python-checkins mailing list