I know similar questions to this have been asked before, but every website seems to define these things differently, and I am trying to follow along the official documentation:
From what I understand so far:
- Class attributes are everything listed in the class Classname:
code block, including the variable declarations above the __init__
functions, static methods, class methods, and methods involving instances with self
link for more info: https://docs.python.org/2/tutorial/classes.html#class-objects
- Instance attributes are both: 1.) every function listed in the class Classname:
code block so everything other than the variable declarations above the __init__
function & 2.) data attributes which is when we use instance.attr
and set that equal to some value
link for more info: https://docs.python.org/2/tutorial/classes.html#instance-objects
Assuming everything I wrote above is correct, I would say an Instance method is any function in the class Classname:
code block since we can apply each method to the instance objects or it could just be the functions that involve self
I'm not sure what I'm understanding incorrectly, but the terminology of the python documentation is totally different from the other sites I've seen. Any help would be greatly appreciated. Thanks!