Conversation
"instance data and functions" together are called attributes, not methods. I believe methods are just the function part.
|
Thanks @jaeyungkim . This is indeed completely wrong and we appreciate the fix! |
|
@mmcky Could you please merge when ready and perhaps consider republishing? |
|
thanks @jstac and @jaeyungkim. I thought that (to be exact) in Python classes self.example_variable = {{ value }}is an while def function(self, args, kwargs)
{{ function code }}is a So classes have both We could be more precise with the statement for sure (thanks @jaeyungkim) so in my view there is still an error in changing to attributes. I'll propose an update. |
| In our example, two functions `earn` and `spend` can be applied to the current instance data. | ||
|
|
||
| Taken together, the instance data and functions are called *methods*. | ||
| Taken together, the instance data and functions are called *attributes*. |
There was a problem hiding this comment.
| Taken together, the instance data and functions are called *attributes*. | |
| In a Class, the instance data are called *attributes* and functions are called *methods*. |
There was a problem hiding this comment.
There are also properties but I don't think we need to mention those.
|
People probably have different opinions here. Google Gemini says the following: Yes, in Python, a method is an attribute of a class. To be precise, a method is a callable attribute of a class. Let's break down what this means: |
|
Please feel free to make the call @mmcky , I'll leave it with you. |
|
Thanks @jstac -- interesting. In that case |
"instance data and functions" together are called attributes, not methods. I believe methods are just the function part.