Files
example-code-2e/25-class-metaprog/evalsupport.py
2021-04-05 18:08:55 -03:00

30 lines
614 B
Python

# tag::BEGINNING[]
print('<[100]> evalsupport module start')
def deco_alpha(cls):
print('<[200]> deco_alpha')
def inner_1(self):
print('<[300]> deco_alpha:inner_1')
cls.method_y = inner_1
return cls
# end::BEGINNING[]
# tag::META_ALEPH[]
class MetaAleph(type):
print('<[400]> MetaAleph body')
def __init__(cls, name, bases, dic):
print('<[500]> MetaAleph.__init__')
def inner_2(self):
print('<[600]> MetaAleph.__init__:inner_2')
cls.method_z = inner_2
# end::META_ALEPH[]
# tag::END[]
print('<[700]> evalsupport module end')
# end::END[]