u might as well make everything global to the file and use functional programming instead of OOP. self.bla would just become a global variable. Obviously you shouldn't because everyone says so, so I must be missing something. Thoughts?
I originally did that when i first started programming. I asked myself why would someone make a program with essentially one class when they're not importing that class... it just makes more typing, more complex, etc. Now i put almost everything in a class to start with, and if it needs it, i pull it out of a class and make it a global function for example.
There are a few reasons why i have switch my method of programming. For one, I got sick of rewriting my code from globals to classes, as it got more complex, classes made it more simple. This is something that you dont really understand untill it happens to you, (over and over and over again).
I originally started using classes more when it gave me a simple method of sending a variable to and from multiple functions. At that point it was worth it to me just to go ahead and use classes so i didnt have to keep creating local variables in the functions, return them, and reassign them back to the original value. And global keyword i just never would use, it created a lot of unexpected results. It was a lot more simple to just assign a class variable and have one of its methods change it, no arguments sent it, no local variable, no returning for just that, just one simple line in hte method.
And then there is of course OOP. Thats a whole explanation in itself. There are a lot of times, where i wrote code, had to rewrite it to a class, because i decided to import it to other code. I just got sick of converting everything to class, so i just start out a program, no matter how small, as a class, and then if it seems more plausable, to remove it and make a global function out of it or split it into multiple classes, and subclasses if necessary. At this pointi can think somewhat ahead, and say "OK, i need this and this, which there are going to be an unkown amount of objects, which in turn means i need to create a class to create X number of instances, this class would be better suited to be a subclass of that class, etc.." Anything other than a class wouldnt make sense.
From there one class turns into 2 classes, 2 classes turns splits into 4 classes, etc. etc.