[Python-Dev] A Hygienic Macro System in Python?

Barry A. Warsaw barry@zope.com
2002年3月19日 21:08:52 -0500


>>>>> "BH" == Bernhard Herzog <bh@intevation.de> writes:

 | doc.BeginTransaction()
 | try:
 | try:
 | something()
 | except:
 | # an error occurred part way through. make sure everything
 | # is reverted (sort of a rollback)
 | doc.AbortTransaction()
 | finally:
 | doc.EndTransaction()
Interesting. I have similar idioms that I use, except that I
invariably would add bare raise after the AbortTransaction().
Neat idea though, that the under statement takes object conforming to
a particular (little `i' :) interface. That seems nicely Pythonic to
me.
-Barry

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