[Python-Dev] PEP 3148 ready for pronouncement [ACCEPTED]

Brian Quinlan brian at sweetapp.com
Mon Jul 12 23:36:18 CEST 2010


On 13 Jul 2010, at 00:59, Titus von der Malsburg wrote:

> On Tue, Jul 13, 2010 at 12:48:35AM +1000, Nick Coghlan wrote:
>> On Tue, Jul 13, 2010 at 12:19 AM, Titus von der Malsburg
>> That's what actually happens, so you can code it either way
>
> That's great!  None of the examples I found used the pythonic
> exception style, that's why I assumed that checking the "return value"
> is the only possibility.  Reading the PEP carefully would have helped.
> :-)

I'd add that it would feel more natural to me to write:

  try:
    print('%r page is %d bytes' % (url, len(future.result())))
- except FutureError:
-   print('%r generated an exception: %s' % (url, future.exception()))
+ except FutureError as e:
+   print('%r generated an exception: %s' % (url, e))

Cheers,
Brian


More information about the Python-Dev mailing list