Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!lightspeed.eweka.nl!lightspeed.eweka.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:not': 0.03; 'operator': 0.03; '22,': 0.09; 'subject:Why': 0.09; 'cc:addr :python-list': 0.11; 'none.': 0.16; 'subject:class': 0.16; 'then?': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'aug': 0.22; 'cc:addr:gmail.com': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**1': 0.23; 'pass': 0.26; 'values': 0.27; 'gets': 0.27; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'larry': 0.31; 'url:python': 0.33; 'fri,': 0.33; 'subject:the': 0.34; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'should': 0.36; 'pm,': 0.38; 'subject:can': 0.39; 'address.': 0.39; 'called': 0.40; 'url:mail': 0.40; 'how': 0.40; 'first': 0.61; 'to:addr:gmail.com': 0.65; 'default': 0.69; 'joel': 0.91 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 :cc:content-type; bh=zUDpWcaxbjVuHbW2crpZzYTv7LJsbX0wbPjn9k88170=; b=pujOv+qzM5vKj9zn+r8yd4Z7XGznPnUWPFIU/MqItKMp3eMGWSmWrGJTi1AAnlXq67 XdtXwlJk+dR/bzm+N9+hD5IMpTj/dR1KpxaODJM+ErbLqJub9Vf+s19DSFHJSSxqUjMW XmDIUwEnscx9zF2HTMP8BHHAgCfZqcxNjUC0CiXTTMxwMSKLu3elKlgKo5eC+mMkILHt 6mYDzsxOC/Z08YNGUDjkfeY7TPYBafSNj2hcvlIRTeRvQMJyP2aosbvtxqibDuMOnfat laOIHMFK2NlOO4foLHT6R7Vf2hVFInJldpMhJDo7+YLc2NxkerdDXs6yGxZuI6VjKSW4 P5rw== MIME-Version: 1.0 X-Received: by 10.180.92.104 with SMTP id cl8mr29096933wib.43.1408718703401; Fri, 22 Aug 2014 07:45:03 -0700 (PDT) In-Reply-To: <53F756BF.1030100@gmail.com> References: <53F752FA.8080902@gmail.com> <53F756BF.1030100@gmail.com> Date: Fri, 22 Aug 2014 10:45:03 -0400 Subject: Re: Why can not initialize the class? From: Joel Goldstick To: luofeiyu Content-Type: text/plain; charset=UTF-8 Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1408718711 news.xs4all.nl 2971 [2001:888:2000:d::a6]:48377 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3769 X-Received-Body-CRC: 1861092644 Xref: csiph.com comp.lang.python:76793 On Fri, Aug 22, 2014 at 10:42 AM, luofeiyu wrote: > how to fix the code then? > > On 8/22/2014 10:36 PM, Larry Martell wrote: >> >> The 'in' operator requires an iterable. When you do 'self.email = email' >> set_email gets called and value is None. > > You might want to set your default values to "" instead of none. When you create an instance of Contact, you should pass the first name, last name, and email address. > -- > https://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com