Why can not initialize the class?

luofeiyu elearn2014 at gmail.com
Fri Aug 22 10:58:49 EDT 2014


 >>> class Contact(object):
...     def __init__(self, first_name=None, last_name=None,
...                  display_name=None, email="haha at haha"):
...         self.first_name = first_name
...         self.last_name = last_name
...         self.display_name = display_name
...         self.email = email
...     def print_info(self):
...         print(self.display_name, "<" + self.email + ">"  )
...     def set_email(self, value):
...         print(value)
...         self._email = value
...     def get_email(self):
...         return self._email
...     email = property(get_email, set_email)
...
 >>>
 >>> contact = Contact()
haha at haha

why the value in `def set_email(self, value): `  is  haha at haha?
how haha at haha  is called to  value in `def set_email(self, value): `?
would you mind telling me the process?

>
>




More information about the Python-list mailing list