What magic method called when the class attribute?

There is the following code:
class MyClass:
pass


MyClass.number = 5
print(MyClass.number)

Kind of magic(e) method is invoked(are) when you assign/access a class attribute?
April 7th 20 at 15:41
1 answer
April 7th 20 at 15:43
Solution
For classes:
type.__setattr__(MyClass, 'number', 5)
MyClass.__dict__['number']
https://docs.python.org/3/reference/datamodel.html
The Custom Classes section describes the process of search of attributes in the classes.
In General the document is very useful:

The default behavior for attribute access is to get, set, or delete the attribute from an object's dictionary. For instance, a.x has a lookup chain starting with a.__dict__['x'], then type(a).__dict__['x'], and continuing through the base classes of type(a) excluding metaclasses. - alexys_Pouros commented on April 7th 20 at 15:46
@trudie, yeah, also found an article:

https://habr.com/ru/post/137415/ - skye.Orn commented on April 7th 20 at 15:49

Find more questions by tags Python