< Object Oriented Programming
Properties in OOP are also able to be looked at as functions, a property houses a function that can have its procedures or variables altered without directly going to the code and editing it. A property can be changed or updated based on user input which allows for a lot of user-interactive programs and applications.
class Marker():
@property
def marker_color(self):
return self._marker_color
@color.setter
def color(self, color):
self._marker_color = Blue
self._marker_color = Red
See also
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.