Home > other >  The dynamic programming, a new world view (a), based on the expansion of the Python
The dynamic programming, a new world view (a), based on the expansion of the Python

Time:09-27

There are two things in the world, an object can be referred to as entities, another is the relationship between objects, in a certain category, entity object can look at a kind of objective existence, their existence does not depend on other objects, and the relationship is different, the existence of relationship, directly or indirectly depend on the entity object, like the inside of the contract, party a party b can be viewed as entity object, and the contract as a kind of rights and obligations between the two sides is a kind of relation, the definition of contract is the existence of this relationship is dependent on the context of the entity object, party a and party b if party a or party b is a company, the company also can be seen as the staff composed of combining various relations and complex, the complex is made up by object according to certain relations, can be seen as a whole entity,
In object-oriented programming language, all entities are regarded as the object, is the embodiment of the monism on the western philosophy, while China's philosophical ideas in addition to care about object also attaches great importance to the relationships between objects, even think that relationship shaped object, will be introduced to the relationship between object oriented programming language, create an object-relational combination of the programming language, is the application of Chinese philosophy, how relationships and object interaction? Mainly embodied in the following aspects: 1, the relationship and the object can be defined, as a complex relationship can also have attributes and methods, 2, relationships can change the behavior of the object, namely change the object's properties and methods, this change can be the object has properties and methods of change, also can add new properties and methods, or delete the existing properties and methods of 3, relationship depends on the specific objects, so the relationship between the life cycle of a generally shorter than the dependent objects, relations were lifted, objects can be restored the original methods and properties,
Python language relational extension:
Python is an object-oriented language, but the whole language is highly customizable, the inside of the Python language object's properties and methods can be changed at run time, can be added to the object instance, change, and delete methods and properties, using the Python language of these features, you can define a class called dynamic object (DynamicObject), the characteristic of this class is when its properties and method names begin with "x_", the properties and methods will be multiple bindings, the so-called multiple bindings is can bind more than once, all binding, but only the last time the binding of effective, for example for dynamic object obj, can call it binding both x_method method, these two methods will be preserved, when using obj. X_method () statement to invoke x_method, call the one that was the last binding method, if use del obj. Delete the obj x_method x_method statements method, delete is the last, the delete behind a x_method will take effect in front, then obj. X_method () call is the first binding method, similarly, the attributes have the same behavior, with such a class, its instance and its derived class instance can support dynamic properties and methods,
  • Related