diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-17 08:00:19 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-17 08:00:19 (GMT) |
commit | d91085598f5185b267ea51a3f615da9527af2ed2 (patch) | |
tree | 80849b9455438e9963a61d7aff3fc3b060213553 /Demo/metaclasses | |
parent | fe55464f393fc002fd0911a4d8dba6694723d408 (diff) | |
download | cpython-d91085598f5185b267ea51a3f615da9527af2ed2.zip cpython-d91085598f5185b267ea51a3f615da9527af2ed2.tar.gz cpython-d91085598f5185b267ea51a3f615da9527af2ed2.tar.bz2 |
Remove apply()
Diffstat (limited to 'Demo/metaclasses')
-rw-r--r-- | Demo/metaclasses/Eiffel.py | 6 | ||||
-rw-r--r-- | Demo/metaclasses/Meta.py | 4 | ||||
-rw-r--r-- | Demo/metaclasses/Simple.py | 2 | ||||
-rw-r--r-- | Demo/metaclasses/Synch.py | 4 | ||||
-rw-r--r-- | Demo/metaclasses/Trace.py | 6 |
5 files changed, 11 insertions, 11 deletions
diff --git a/Demo/metaclasses/Eiffel.py b/Demo/metaclasses/Eiffel.py index 24fac14..8c39746 100644 --- a/Demo/metaclasses/Eiffel.py +++ b/Demo/metaclasses/Eiffel.py @@ -82,10 +82,10 @@ class EiffelMethodWrapper(MetaMethodWrapper): def __call__(self, *args, **kw): if self.pre: - apply(self.pre, args, kw) - Result = apply(self.func, (self.inst,) + args, kw) + self.pre(*args, **kw) + Result = self.func(self.inst, *args, **kw) if self.post: - apply(self.post, (Result,) + args, kw) + self.post(Result, *args, **kw) return Result class EiffelHelper(MetaHelper): diff --git a/Demo/metaclasses/Meta.py b/Demo/metaclasses/Meta.py index 580f582..9529e0f 100644 --- a/Demo/metaclasses/Meta.py +++ b/Demo/metaclasses/Meta.py @@ -14,7 +14,7 @@ class MetaMethodWrapper: self.__name__ = self.func.__name__ def __call__(self, *args, **kw): - return apply(self.func, (self.inst,) + args, kw) + return self.func(self.inst, *args, **kw) class MetaHelper: @@ -86,7 +86,7 @@ class MetaClass: init = inst.__getattr__('__init__') except AttributeError: init = lambda: None - apply(init, args, kw) + init(*args, **kw) return inst diff --git a/Demo/metaclasses/Simple.py b/Demo/metaclasses/Simple.py index 03ed259..e3e54f7 100644 --- a/Demo/metaclasses/Simple.py +++ b/Demo/metaclasses/Simple.py @@ -28,7 +28,7 @@ class BoundMethod: self.instance = instance def __call__(self, *args): print "calling", self.function, "for", self.instance, "with", args - return apply(self.function, (self.instance,) + args) + return self.function(self.instance, *args) Trace = Tracing('Trace', (), {}) diff --git a/Demo/metaclasses/Synch.py b/Demo/metaclasses/Synch.py index 80e52d9..cd13e86 100644 --- a/Demo/metaclasses/Synch.py +++ b/Demo/metaclasses/Synch.py @@ -148,10 +148,10 @@ from Meta import MetaClass, MetaHelper, MetaMethodWrapper class LockingMethodWrapper(MetaMethodWrapper): def __call__(self, *args, **kw): if self.__name__[:1] == '_' and self.__name__[1:] != '_': - return apply(self.func, (self.inst,) + args, kw) + return self.func(self.inst, *args, **kw) self.inst.__lock__.acquire() try: - return apply(self.func, (self.inst,) + args, kw) + return self.func(self.inst, *args, **kw) finally: self.inst.__lock__.release() diff --git a/Demo/metaclasses/Trace.py b/Demo/metaclasses/Trace.py index 69b9fab..97fda56 100644 --- a/Demo/metaclasses/Trace.py +++ b/Demo/metaclasses/Trace.py @@ -50,7 +50,7 @@ class TraceMetaClass: init = inst.__getattr__('__init__') except AttributeError: init = lambda: None - apply(init, args, kw) + init(*args, **kw) return inst __trace_output__ = None @@ -85,7 +85,7 @@ class NotTracingWrapper: self.func = func self.inst = inst def __call__(self, *args, **kw): - return apply(self.func, (self.inst,) + args, kw) + return self.func(self.inst, *args, **kw) class TracingWrapper(NotTracingWrapper): def __call__(self, *args, **kw): @@ -93,7 +93,7 @@ class TracingWrapper(NotTracingWrapper): "calling %s, inst=%s, args=%s, kw=%s", self.__name__, self.inst, args, kw) try: - rv = apply(self.func, (self.inst,) + args, kw) + rv = self.func(self.inst, *args, **kw) except: t, v, tb = sys.exc_info() self.inst.__trace_call__(self.inst.__trace_output__, |