File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ def get_registry(cls):
2020 return dict (cls .REGISTRY )
2121
2222
23- class BaseRegisteredClass (metaclass = RegistryHolder ):
23+ class BaseRegisteredClass :
24+ __metaclass__ = RegistryHolder
2425 """
2526 Any class that will inherits from BaseRegisteredClass will be included
2627 inside the dict RegistryHolder.REGISTRY, the key being the name of the
@@ -30,18 +31,20 @@ class and the associated value, the class itself.
3031
3132if __name__ == "__main__" :
3233 print ("Before subclassing: " )
33- for k in RegistryHolder .REGISTRY :
34+ for k in RegistryHolder .REGISTRY . keys () :
3435 print (k )
3536
3637 class ClassRegistree (BaseRegisteredClass ):
3738
3839 def __init__ (self , * args , ** kwargs ):
3940 pass
41+
42+
4043 print ("After subclassing: " )
4144 for k in RegistryHolder .REGISTRY :
4245 print (k )
4346
44- ### OUTPUT ###
47+ ### OUTPUT ###
4548# Before subclassing:
4649# BaseRegisteredClass
4750# After subclassing:
You can’t perform that action at this time.
0 commit comments