Feb-18-2019, 08:18 PM
I'm trying to get a grasp on Python classes and want to clarify something.
If I use a variable name like "count" inside a class and also have a "count" variable outside the class then I *must* use self.count inside the class or python will use the global instead?
So when writing any class all "local" variables really have to be written as self.var or they could clash with variables in the main program?
If I use a variable name like "count" inside a class and also have a "count" variable outside the class then I *must* use self.count inside the class or python will use the global instead?
So when writing any class all "local" variables really have to be written as self.var or they could clash with variables in the main program?