You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of our students did the following properties to normalize the names of the Donors in mailroom.
Could that code repetition be avoided with some meta-programming?
@property
def first_name(self):
""" return the first name """
return self._first_name
@first_name.setter
def first_name(self, value):
""" set the first name """
self._first_name = value.title()
@property
def middle_name(self):
""" return the middle name """
return self._middle_name
@middle_name.setter
def middle_name(self, value):
""" set the middle name """
self._middle_name = value.title()
@property
def last_name(self):
""" return the last name """
return self._last_name
@last_name.setter
def last_name(self, value):
""" set the last name """
self._last_name = value.title()
@property
def suffix(self):
""" return the suffix """
return self._suffix
The text was updated successfully, but these errors were encountered:
One of our students did the following properties to normalize the names of the Donors in mailroom.
Could that code repetition be avoided with some meta-programming?
The text was updated successfully, but these errors were encountered: