From f73963dd0a58c4a7fdf036c72de77beef7974e14 Mon Sep 17 00:00:00 2001 From: "Phillip J. Eby" Date: Tue, 1 May 2007 00:32:18 +0000 Subject: [PATCH] Fix missing imports in examples --- pep-3124.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pep-3124.txt b/pep-3124.txt index 234f525e5..11bd72558 100755 --- a/pep-3124.txt +++ b/pep-3124.txt @@ -179,6 +179,8 @@ annotations. The following function definitions have identical effects, except for name binding side-effects (which will be described below):: + from overloading import when + @overload def flatten(ob: basestring): yield ob @@ -325,10 +327,11 @@ System (CLOS), or the corresponding "advice" types in AspectJ. Like ``@when``, all of these decorators must be passed the function to be overloaded, and can optionally accept a predicate as well:: + from overloading import before, after + def begin_transaction(db): print "Beginning the actual transaction" - @before(begin_transaction) def check_single_access(db: SingletonDB): if db.inuse: @@ -383,6 +386,8 @@ continue the invocation process. "Around" methods are usually used to transform input arguments or return values, or to wrap specific cases with special error handling or try/finally conditions, e.g.:: + from overloading import around + @around(commit_transaction) def lock_while_committing(__proceed__, db: SingletonDB): with db.global_lock: