[Python-checkins] python/nondist/peps pep-0333.txt,1.6,1.7

pje at users.sourceforge.net pje at users.sourceforge.net
Wed Sep 1 22:35:45 CEST 2004


Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2121

Modified Files:
	pep-0333.txt 
Log Message:
Fix some typos, and clean up/clarify language regarding iterables so
that Alan's Jython-based server will be compatible with the "letter of
the law" of the spec.

Index: pep-0333.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0333.txt,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pep-0333.txt	1 Sep 2004 13:44:07 -0000	1.6
+++ pep-0333.txt	1 Sep 2004 20:35:42 -0000	1.7
@@ -773,11 +773,18 @@
 more complex:
 
 * You may not return a file object and expect it to work as an iterable,
-  since before Python 2.2, files were not iterable.
+  since before Python 2.2, files were not iterable.  (Some servers
+  may loosen this guideline by checking for ``types.FileType``, but
+  this is an optional, server-specific extension.  If you want your
+  application code to be used with pre-2.2 Pythons such as Jython,
+  you should *not* return a file object; use a pre-2.2 iterable
+  or a sequence instead.)
 
-* If you return an iterable, it **must** implement the pre-2.2 iterator
-  protocol.  That is, provide a ``__getitem__`` method that accepts
-  an integer key, and raises ``IndexError`` when exhausted.
+* If you return a custom iterable, it **must** implement the pre-2.2
+  iterator protocol.  That is, provide a ``__getitem__`` method that
+  accepts an integer key, and raises ``IndexError`` when exhausted.
+  (Note that built-in sequence types are also acceptable, since they
+  also implement this protocol.)
 
 Finally, middleware that wishes to support pre-2.2 versions of Python,
 and iterates over application return values or itself returns an 
@@ -863,7 +870,7 @@
 ``fileno`` attribute if it is anything other than a method returning
 an **operating system file descriptor**.  "File-like" objects
 that do not possess a true operating system file descriptor number
-are expressly.  Servers running on platforms where file
+are expressly forbidden.  Servers running on platforms where file
 descriptors do not exist, or where there is no meaningful API for
 accelerating transmission from a file descriptor should ignore the
 ``fileno`` attribute.



More information about the Python-checkins mailing list