diff --git a/README.md b/README.md index a934f64..16160aa 100644 --- a/README.md +++ b/README.md @@ -2093,7 +2093,7 @@ Metaprograming ``` ### Meta Class -**Class that creates class.** +**Class that creates classes.** ```python def my_meta_class(name, parents, attrs): @@ -2113,7 +2113,7 @@ class MyMetaClass(type): * **New() can also be called directly, usually from a new() method of a child class (**`def __new__(cls): return super().__new__(cls)`**), in which case init() is not called.** ### Metaclass Attribute -**Right before a class is created it checks if it has metaclass defined. If not, it recursively checks if any of his parents has it defined and eventually comes to type().** +**Right before a class is created it checks if it has metaclass attribute defined. If not, it recursively checks if any of his parents has it defined and eventually comes to type().** ```python class MyClass(metaclass=MyMetaClass): diff --git a/index.html b/index.html index 37b90e5..d59350c 100644 --- a/index.html +++ b/index.html @@ -1824,7 +1824,7 @@ param_names = list(<sig>.parameters.keys())
>>> Z = type('Z', (), {'a': 'abcde', 'b': 12345})
>>> z = Z()
-Class that creates class.
def my_meta_class(name, parents, attrs):
+Meta Class
Class that creates classes.
def my_meta_class(name, parents, attrs):
attrs['a'] = 'abcde'
return type(name, parents, attrs)
@@ -1841,7 +1841,7 @@ param_names = list(<sig>.parameters.keys())
It receives the same arguments as init(), except for the first one that specifies the desired class of returned instance (MyMetaClass in our case).
New() can also be called directly, usually from a new() method of a child class (def __new__(cls): return super().__new__(cls)
), in which case init() is not called.
-Metaclass Attribute
Right before a class is created it checks if it has metaclass defined. If not, it recursively checks if any of his parents has it defined and eventually comes to type().
class MyClass(metaclass=MyMetaClass):
+Metaclass Attribute
Right before a class is created it checks if it has metaclass attribute defined. If not, it recursively checks if any of his parents has it defined and eventually comes to type().
class MyClass(metaclass=MyMetaClass):
b = 12345