[Python-ideas] Implied try blocks

Antoine Pitrou solipsis at pitrou.net
Sun Mar 25 17:19:05 CEST 2012


On 2012年3月25日 10:15:05 -0400
Calvin Spealman <ironfroggy at gmail.com>
wrote:
>> What if we allowed this to be implied and except/else blocks bound to
> the previous
> statement? A try block would be an optional form, and mostly left for
> multi-block try's
>> r = some_single_statement()
> except TypeError:
> print "oh no!"
> raise OhNoException()
> else:
> p = prepare(r)
> print "I got", p

Saving one line and four non-whitespace characters?
-1 from me.
cheers
Antoine.


More information about the Python-ideas mailing list

AltStyle によって変換されたページ (->オリジナル) /