Python object-oriented encapsulation
A concept of encapsulation
In fact, packaging is everywhere in our life, such as televisions, computers, mobile phones and other items. Usually, we can only see the external shape and use the functions provided by them, but we can't see the complex hardware composition inside. These are encapsulated and can't be seen by us. We can avoid so ...
Posted by GundamSV7 on Sun, 06 Mar 2022 06:09:38 +0100
Advance Python 07: metaclass programming
Introduce
Property dynamic propertygetattr,__ getattribute__ Magic functionAttribute descriptor and attribute lookup processThe difference between new and initCustom metaclassImplement ORM through metaclass
1, Property dynamic property
from datetime import date
class User:
def __init__(self, name, birthday):
self.name = name ...
Posted by mraza on Tue, 08 Feb 2022 19:11:31 +0100