I’m going to slowly add content in this posting but the topic is how code objects in python.
Everything in Python is consider an object and tricky to keep track of everything you can do with objects.
Here is a basic structure of a class
class foo: pass
The class object foo doesn’t do much so next I’m going to make a point object. This class will have a constructor that takes in two inputted objects and a method to return the x and y positions of the point.
class point: # Constructor - Note: No checks on inputted values. def __init__(self, Incoming_X, Incoming_Y): self.x =Incoming_X self.y = Incoming_Y # Get Method: Returns x & y as a list def get(): return([self.x, self.y])
You can also use classes with decorators
@bar class foo: pass
IBM’s developerWorks Python 3 Primer
PEP 3129 – Class Decorators