Use decorators.

This commit is contained in:
Guido van Rossum 2005-01-16 00:16:11 +00:00
parent 9ba3684ecc
commit 75b64e65f1
3 changed files with 8 additions and 15 deletions

View file

@ -9,6 +9,7 @@ class EiffelBaseMetaClass(type):
return super(EiffelBaseMetaClass, meta).__new__(meta, name, bases,
dict)
@classmethod
def convert_methods(cls, dict):
"""Replace functions in dict with EiffelMethod wrappers.
@ -30,11 +31,10 @@ class EiffelBaseMetaClass(type):
if pre or post:
dict[k] = cls.make_eiffel_method(dict[m], pre, post)
convert_methods = classmethod(convert_methods)
class EiffelMetaClass1(EiffelBaseMetaClass):
# an implementation of the "eiffel" meta class that uses nested functions
@staticmethod
def make_eiffel_method(func, pre, post):
def method(self, *args, **kwargs):
if pre:
@ -49,8 +49,6 @@ class EiffelMetaClass1(EiffelBaseMetaClass):
return method
make_eiffel_method = staticmethod(make_eiffel_method)
class EiffelMethodWrapper:
def __init__(self, inst, descr):