[Python-checkins] r82950 - peps/trunk/pep-3148.txt
georg.brandl
python-checkins at python.org
Sun Jul 18 15:12:03 CEST 2010
Author: georg.brandl
Date: Sun Jul 18 15:12:03 2010
New Revision: 82950
Log:
Update from Brian; make links work.
Modified:
peps/trunk/pep-3148.txt
Modified: peps/trunk/pep-3148.txt
==============================================================================
--- peps/trunk/pep-3148.txt (original)
+++ peps/trunk/pep-3148.txt Sun Jul 18 15:12:03 2010
@@ -200,7 +200,7 @@
``result(timeout=None)``
- Return the value returned by the call. If the call hasn't yet
+ Return the value returned by the call. If the call hasn't yet
completed then this method will wait up to *timeout* seconds. If
the call hasn't completed in *timeout* seconds then a
`TimeoutError` will be raised. If *timeout* is not specified or
@@ -372,12 +372,12 @@
for future in futures.as_completed(future_to_url):
url = future_to_url[future]
- if future.exception() is not None:
- print('%r generated an exception: %s' % (
- url, future.exception()))
- else:
+ try:
print('%r page is %d bytes' % (
url, len(future.result())))
+ except Exception as e:
+ print('%r generated an exception: %s' % (
+ url, e))
if __name__ == '__main__':
main()
@@ -419,11 +419,22 @@
Anh Hai Trinh proposed a simpler but more limited API concept [5]_ and
the API has been discussed in some detail on stdlib-sig [6]_.
+The proposed design was discussed on the Python-Dev mailing list [7]_.
+Following those discussions, the following changes were made:
+
+* The `Executor` class was made into an abstract base class
+* The `Future.remove_done_callback` method was removed due to a lack
+ of convincing use cases
+* The `Future.add_done_callback` method was modified to allow the
+ same callable to be added many times
+* The `Future` class's mutation methods were better documented to
+ indicate that they are private to the `Executor` that created them
+
========================
Reference Implementation
========================
-The reference implementation [7]_ contains a complete implementation
+The reference implementation [8]_ contains a complete implementation
of the proposed design. It has been tested on Linux and Mac OS X.
==========
@@ -432,31 +443,35 @@
.. [1]
`java.util.concurrent` package documentation
- `http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/package-summary.html`
+ http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/package-summary.html
.. [2]
Python Cookbook recipe 84317, "Easy threading with Futures"
- `http://code.activestate.com/recipes/84317/`
+ http://code.activestate.com/recipes/84317/
.. [3]
`Python-3000` thread, "mechanism for handling asynchronous concurrency"
- `http://mail.python.org/pipermail/python-3000/2006-April/000960.html`
+ http://mail.python.org/pipermail/python-3000/2006-April/000960.html
.. [4]
`Python 3000` thread, "Futures in Python 3000 (was Re: mechanism for handling asynchronous concurrency)"
- `http://mail.python.org/pipermail/python-3000/2006-April/000970.html`
+ http://mail.python.org/pipermail/python-3000/2006-April/000970.html
.. [5]
A discussion of `stream`, a similar concept proposed by Anh Hai Trinh
- `http://www.mail-archive.com/stdlib-sig@python.org/msg00480.html`
+ http://www.mail-archive.com/stdlib-sig@python.org/msg00480.html
.. [6]
A discussion of the proposed API on stdlib-sig
- `http://mail.python.org/pipermail/stdlib-sig/2009-November/000731.html`
+ http://mail.python.org/pipermail/stdlib-sig/2009-November/000731.html
.. [7]
+ A discussion of the PEP on python-dev
+ http://mail.python.org/pipermail/python-dev/2010-March/098169.html
+
+.. [8]
Reference `futures` implementation
- `http://code.google.com/p/pythonfutures/source/browse/#svn/branches/feedback`
+ http://code.google.com/p/pythonfutures/source/browse/#svn/branches/feedback
=========
Copyright
More information about the Python-checkins
mailing list