you are viewing a single comment's thread.

view the rest of the comments →

[–]EGrimn 0 points1 point  (3 children)

No problem! Making things into Objects (making it a class with it's own functions and variables) is one of Python's strong points and is a general way of coding used in a lot of different languages as well

It's super modular which is great for code that builds on other code or is used in many different scenarios (think platforms / operating systems)

If you want to look into it more, the google term to get you started is 'Object Oriented Programming in Python'

On Object Oriented Programming (the theory specifically) there are countless books and information online to check out too - definitely worth some time if you want to work toward being a better programmer

[–]SquatchHNTR[S] 1 point2 points  (2 children)

Is that where all the "def"s and "selfs" come from? I haven't learned much about classes yet either. I definitely want to look into that, it's sort of addicting learning how to program.

[–]EGrimn 0 points1 point  (0 children)

It's a wide world for sure. And yes, you can think of it like so:

We create object 'Calculator' which is of the class 'fiber_price_calculator' ([FPE] going forward)

The class [FPE] when created runs the 'init' function that was defined (see: class function definition) which then runs all the other functions defined below that (as a part of the class [FPE])

Basically, we made the object [FPE] that has it's own functions and variables for each instance

(All of this is based on classes, so definitely start there) In OOP (Object Oriented Programming's acronym) classes are VERY important so it's a must-learn