Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76797

Re: Why can not initialize the class?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <larry.martell@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.029
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'subject:not': 0.03; '22,': 0.09; 'subject:Why': 0.09; 'def': 0.12; 'display_name': 0.16; 'process?': 0.16; 'subject:class': 0.16; 'wrote:': 0.18; 'aug': 0.22; 'to:name:python-list@python.org': 0.22; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'class': 0.32; 'url:python': 0.33; 'fri,': 0.33; 'skip:_ 10': 0.34; 'subject:the': 0.34; 'received:google.com': 0.35; 'subject:?': 0.36; 'url:org': 0.36; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'called': 0.40; 'how': 0.40; 'url:3': 0.61; 'telling': 0.64; 'contact': 0.67; 'url:4': 0.69
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=se/XLS6ZxHmQpVh+LEmP7BvhamQzQn6QFO/Y3caFSmY=; b=mWqv5eGYkDm76QpRQ+cvpND1/9W9G7TGrybZTpmMl6PqIAj+adEpg0DflZx/NA2CqH 7o97QrgeYvnZ23WeIxOfN9KsoaYaW98yIuybN7jdCOPAGwG7icxJpcVwmJMHUGo5/Co1 o7o3HaKqfRGhKvczsvrGVA+qmLiTsVJKd9m0AQyADAknpBPpDsar2/odlEms/t/LRmk4 VIP9VQwfRtlD7pfTipAdXTTmp54q4+aNFhC0s0FZTR4cUobe+kV4Lok+pHaM4WYrqf1R 6e8oAe4xlevtYMHpjlJwACRiuW5La2evLpj6mASBlxBTLch08u1lFnlTYCd+BecDJmTU Jeuw==
MIME-Version 1.0
X-Received by 10.180.24.35 with SMTP id r3mr11016140wif.71.1408719760058; Fri, 22 Aug 2014 08:02:40 -0700 (PDT)
In-Reply-To <53F75AA9.8010208@gmail.com>
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> <53F75AA9.8010208@gmail.com>
Date Fri, 22 Aug 2014 11:02:40 -0400
Subject Re: Why can not initialize the class?
From Larry Martell <larry.martell@gmail.com>
To "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.13294.1408719768.18130.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1408719768 news.xs4all.nl 2921 [2001:888:2000:d::a6]:33100
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76797

Show key headers only | View raw


On Fri, Aug 22, 2014 at 10:58 AM, luofeiyu <elearn2014@gmail.com> wrote:
>>>> 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?

https://docs.python.org/3.4/library/functions.html#property

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Why can not initialize the class? Larry Martell <larry.martell@gmail.com> - 2014-08-22 11:02 -0400

csiph-web