Python Object-Oriented Programming: Doing Math Just Once Beats Repetition


Simple Trig Graph

Although I don’t know whether OOP will be central to our exploration of NumPy, Pandas and other Python libraries for analytics,  here is a simple example of what I find useful.

I want to be able to perform any one of a set of related x,y matrix expressions, and do so repeatedly without re-specifying the math.  To do this, I created my own Python class and built in some math expressions, with some specified as class-level methods and others as instance level functions.  Along the way, I learned to value a class-level expression to help reduce repetitive instance-level coding.  To have a look, click into GitHub: OOP Python Class with Trigonometry.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s