Python Property 和 Atrribute的区别

用英语怎么说访问attribute引发的chain of thought

Posted by ZHAI YU on February 20, 2024

On preparing for tomorrows’ lab seminar, I encountered some issue about how can I say in English about get the property and attribute value. Then I searched and found an interesting issue that I haven’t solved long long time ago: property and attribute in class defination in python

So what is attribute?

They are important concepts of object-oriented programming which allows object have charateristic and behaviors. The answer to my question is that attributes and method can be “accessed” using the dot (‘.’) operator.

What is property?

It’s an @ method in class defination which you could use to change static attribute into a method and setting setter and getter to the attribute so that the code wil be more robust.

csdn