Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76796
| Date | 2014-08-22 22:58 +0800 |
|---|---|
| From | luofeiyu <elearn2014@gmail.com> |
| Subject | Re: Why can not initialize the class? |
| References | <53F752FA.8080902@gmail.com> <CACwCsY5P_8OUma6yMJxNCDd1WHtNrM0_ck2oebLv3mpPF20WCQ@mail.gmail.com> <53F756BF.1030100@gmail.com> <CAPM-O+wJi-ZLUyP+E=9DP+gje8k0O04nP6yuhrG75f2oQTMJZQ@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13293.1408719557.18130.python-list@python.org> (permalink) |
>>> class Contact(object): ... def __init__(self, first_name=None, last_name=None, ... display_name=None, email="haha@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@haha why the value in `def set_email(self, value): ` is haha@haha? how haha@haha is called to value in `def set_email(self, value): `? would you mind telling me the process? > >
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Why can not initialize the class? luofeiyu <elearn2014@gmail.com> - 2014-08-22 22:58 +0800
Re: Why can not initialize the class? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-23 01:17 +1000
Re: Why can not initialize the class? luofeiyu <elearn2014@gmail.com> - 2014-08-23 07:29 +0800
Re: Why can not initialize the class? CHIN Dihedral <dihedral88888@gmail.com> - 2014-08-23 10:25 -0700
Re: Why can not initialize the class? Michael Torrie <torriem@gmail.com> - 2014-08-23 20:03 -0600
Re: Why can not initialize the class? alex23 <wuwei23@gmail.com> - 2014-08-25 16:33 +1000
csiph-web