classes and objects
kind
object
Object-oriented OO (Object-oriented): integration, encapsulation, polymorphism
OOA -> OOD -> OOP
self keyword, similar to java's this
Magic method: __init__(self)\__new__(cls[,...])\__del__(self)
Control permission: public\private (pseudo-private, name mangling: name mangling)
combination
to give a few examples
--------------- --------------- --------------- --------------- ---------------
1. Define a class and create an instance
2,
--------------- --------------- --------------- --------------- ---------------
Some related BIFs
--------------- --------------- --------------- --------------- ---------------
issubclass(subclass, classs)
isinstance(object, class)
hasattr(object, name)
getattr(object, name[,default])
setattr(object, name, value)
delattr(obj, name)
--------------- --------------- --------------- --------------- ---------------
Construct __init__(self) and destruct __del__(self)
Descriptor (Property Principle)
A descriptor is an attribute that assigns an instance of a particular type of class to another class.