The Python Class

Ahh, the Python Class, and I don’t mean a Classroom full of students.  

I found a EXCELLENT YouTube channel for explaining aspects of Python.  In fact, it’s the same place I found the logger videos.  I didn’t realize it was the same person at first, but once I did, I bookmarked it!  

His name is Corey Schafer’s and his videos are located at the following link. 
https://www.youtube.com/user/schafer5/playlists

Now that I have learned the basics of a Class, I’m starting to use it already in my overhaul of the graph section of my Sensor Program.  It should clean up my code very nicely, because I can forward one class object to the graph function, and it will hold ALL the needed data!  Right now, I have been sending each needed variable to each function, which had up to 6 variables!  It wasn’t pretty, that’s for sure.  However, with a data class, I can store everything that’s needed, pass the one class instance, and BAM!  Nice looking code, pretty much unlimited variables, and I can create as many instances as I want, with very little code!  It was even nicer when I realized I can add new variables (or function) to it, without having to adjust every function that uses it.  All very good things ^_^  

I have to admit, I have not actually added any new functionality to the program at all, but I have been learning a lot on how to improve the existing code and set the foundation of future enhancements.  Add on to this, GitHub and PyCharm, and the management of the code has also greatly improved!  

So although not adding thing to the program seems to be bothering me, I know it’s for a good cause and will help much more in the long run.  So I guess overall, I’m feeling pretty good with the progress.  

On another side note, my “step dad” / “Friend” / “something?” … not sure what to call him, but he’s awesome and knows a lot around chemistry and science.  Anyway, I asked for a bit of input from him about what sensors I might add and what I might be able to figure out with long or short term readings of said sensors.  He’s going to give it some thought and get back to me.  So I’m excited about that!  I’m hoping it will lead to practical use of my project to find out something new or cool!  

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>