Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76832
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <elearn2014@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.041 |
| X-Spam-Evidence | '*H*': 0.92; '*S*': 0.00; 'subject:not': 0.03; 'subject:Why': 0.09; 'def': 0.12; 'subject:class': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; 'class': 0.32; 'skip:_ 10': 0.34; 'subject:the': 0.34; 'skip:s 30': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version:': 0.36; 'subject:?': 0.36; 'received:10': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'little': 0.38; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'charset:windows-1252': 0.65; 'contact': 0.67; 'mistake': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=tBIK6YkVRoeRX6/76Vh1Rk5STD+mJRiqSNiCqlB2dHY=; b=JM0yezHovh+VM6oHtGY7vd15XYT32pgNw1GqQeU7Iue8xpR1fyoD7uucGGBtv9L6Dt jtpXsOqgiwA1iRS/8yd8HJgfIa7G2XqfM5BotcTQB2MEY3+NKhWYDpMiv9AjZwiCkhTr hfJLaCdKGXtkP4nHf3/LQVliEX6b5xSyYw7Wu0pL7oq1eQMbFuf6+QG+O7OGh601Et4s 2pPG4wuIlsxtqSXcB4X3KMywWyoZTrCsvbVUZd++sGnPiBnBi4jFffRwYdA0jZ2miG2M M1FWTLmP6cx8f56Q7IUuKuH+ME3WSsfqSUFux5DpEchkLBpkYynKyWgfKquNNbpaKWAb VAfQ== |
| X-Received | by 10.70.103.204 with SMTP id fy12mr9961067pdb.144.1408750210719; Fri, 22 Aug 2014 16:30:10 -0700 (PDT) |
| Date | Sat, 23 Aug 2014 07:29:44 +0800 |
| From | luofeiyu <elearn2014@gmail.com> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
| MIME-Version | 1.0 |
| To | Steven D'Aprano <steve+comp.lang.python@pearwood.info>, python-list@python.org |
| 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> <mailman.13293.1408719557.18130.python-list@python.org> <53f75f22$0$6512$c3e8da3$5496439d@news.astraweb.com> |
| In-Reply-To | <53f75f22$0$6512$c3e8da3$5496439d@news.astraweb.com> |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13318.1408750213.18130.python-list@python.org> (permalink) |
| Lines | 25 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1408750213 news.xs4all.nl 2970 [2001:888:2000:d::a6]:51204 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:76832 |
Show key headers only | View raw
One final version:
class Contact(object):
def __init__(self, email="haha@haha"):
self.email = email
def _get_email(self):
return self._the_secret_private_email
def _set_email(self, value):
self.self._the_secret_private_email = value
email = property(_get_email, _set_email)
contact = Contact()
print(contact.email)
There is a little mistake here. It is
self._the_secret_private_email = value
not
self.self._the_secret_private_email = value
think for your demo .The value in `def _set_email(self, value):` is the value of self.email .
Back to comp.lang.python | Previous | Next — Previous in thread | 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