[Python-ideas] except expression
Ben Finney
ben+python at benfinney.id.au
Sat Feb 15 07:09:17 CET 2014
"Stephen J. Turnbull" <stephen at xemacs.org>
writes:
> Ben Finney writes:
> > try:
> > response_text = request('http://whatever.com').text
> > except HttpError:
> > "Can't access data"
>
> This has incorrect semantics. The correct semantics would be
>
> try:
> response_text = request('http://whatever.com').text
> except HttpError:
> response_text = "Can't access data"
>
> I assume.
You assume correctly; I wrote the above code too hastily. Thanks for the
correction.
--
\ “Shepherds … look after their sheep so they can, first, fleece |
`\ them and second, turn them into meat. That's much more like the |
_o__) priesthood as I know it.” —Christopher Hitchens, 2008-10-29 |
Ben Finney
More information about the Python-ideas
mailing list