before we get into the detailslet' discuss some bad object-oriented theory many object-oriented languages (java is the most notoriousteach us to never access attributes directly they insist that we write attribute access like thisclass colordef __init__(selfrgb_valuename)self _rgb_value rgb_value self _name name def set_name(selfname)self _name name def get_name(self)return self _name the variables are prefixed with an underscore to suggest that they are private (other languages would actually force them to be privatethen the get and set methods provide access to each variable this class would be used in practice as followsc color("#ff ""bright red" get_name('bright redc set_name("red" get_name('redthis is not nearly as readable as the direct access version that python favorsclass colordef __init__(selfrgb_valuename)self rgb_value rgb_value self name name color("#ff ""bright red"print( namec name "redso why would anyone insist upon the method-based syntaxtheir reasoning is that someday we may want to add extra code when value is set or retrieved for examplewe could decide to cache value and return the cached valueor we might want to validate that the value is suitable input