Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76790
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:not': 0.03; 'argument': 0.05; '__init__': 0.09; 'subject:Why': 0.09; 'def': 0.12; 'code?': 0.16; 'display_name': 0.16; 'iterable': 0.16; 'subject:class': 0.16; 'typeerror:': 0.16; 'header:User-Agent:1': 0.23; 'error': 0.23; 'raise': 0.29; "doesn't": 0.30; '"",': 0.31; 'file': 0.32; 'class': 0.32; '(most': 0.33; 'skip:_ 10': 0.34; 'subject:the': 0.34; 'received:google.com': 0.35; 'subject:?': 0.36; 'wrong': 0.37; 'received:10': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'contact': 0.67 |
| 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 :content-type:content-transfer-encoding; bh=SCvIp4+FAm8D3+j9t1Q4juQ78loJsz9xCCIhNXhXaqI=; b=ZjJt3g/ZJ6zaLzlLhx2GrDds3D3trF5cykA7E37hgrxwE+14kTwWzXyNzVh4dMgzJg vn1bJsTh4PzJV0NhlcKr8BtcVew621Lh9iMO1Ugxg3Yj+HhVbNTTtD0nNN8J3q+0AzTh M50nObOztU0u0sBsB3LHWhbs3UKfIb/G18dN7k4PE52ds2UpU733o8cqESqCoW68HA64 g21/T8dEarQONQz4K0w0sP67mFVryRpwdkGs7tofC+vI7IpwKFO7h53JAybbtQN7dfzu rMkzPQqkQiaL4yXnJhvYzQjF1Fj6EzP5DcYXG2kO2OmwhKFfr2cbAIt6IJ2KkVPUIoTl xuBw== |
| X-Received | by 10.68.167.133 with SMTP id zo5mr6755968pbb.21.1408717585015; Fri, 22 Aug 2014 07:26:25 -0700 (PDT) |
| Date | Fri, 22 Aug 2014 22:26:02 +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 | python-list@python.org |
| Subject | Why can not initialize the class? |
| Content-Type | text/plain; charset=utf-8; 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.13287.1408717593.18130.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1408717593 news.xs4all.nl 2959 [2001:888:2000:d::a6]:37324 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:76790 |
Show key headers only | View raw
System:win7+python34.
class Contact(object):
def __init__(self, first_name=None, last_name=None,
display_name=None, email=None):
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):
if '@' not in value:
raise Exception("This doesn't look like an email address.")
self._email = value
def get_email(self):
return self._email
email = property(get_email, set_email)
contact = Contact()
The error message is :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 7, in __init__
File "<stdin>", line 11, in set_email
TypeError: argument of type 'NoneType' is not iterable
What is wrong with the code?
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Why can not initialize the class? luofeiyu <elearn2014@gmail.com> - 2014-08-22 22:26 +0800
csiph-web