ch25: simple enum metaclasses

This commit is contained in:
Luciano Ramalho
2021-04-05 18:08:55 -03:00
parent 2f8bf06270
commit 2e064d68a1
8 changed files with 327 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
# 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[]