OOP And ORMs in Python
Object-Oriented Programming · Python, along with many other programming langauges, use Object-Oriented Programming (OOP). An ‘object’ is a discrete item. OOP allows for the creation of classes, which are the generic forms of objects. For example, a ‘flight’ class is defines all the components which describe a flight, as well as actions that a flight should be able to take, such as adding a passenger. Similarly, a passenger class would represent the generic idea of passenger, defined by a name and associated with a flight, perhaps. · Here’s a simple example of a Python class. · class Flight : · · def __init__ ( self , origin, destination, duration): · ...