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


Groups > comp.lang.python > #76968 > unrolled thread

Re: Why can not initialize the class?

Started byAntoon Pardon <antoon.pardon@rece.vub.ac.be>
First post2014-08-25 09:51 +0200
Last post2014-08-25 09:51 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Why can not initialize the class? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-08-25 09:51 +0200

#76968 — Re: Why can not initialize the class?

FromAntoon Pardon <antoon.pardon@rece.vub.ac.be>
Date2014-08-25 09:51 +0200
SubjectRe: Why can not initialize the class?
Message-ID<mailman.13404.1408953095.18130.python-list@python.org>
On 23-08-14 01:20, Terry Reedy wrote:
> On 8/22/2014 10:26 AM, luofeiyu wrote:
>> 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() 
>
> By posting code with an extra indent, you make it imposible to run by just cutting and pasting. You should already know that.

I think your priorities are off. I often enought see people posting code
that was copy-pasted from an interactive python session complete with
lines beginning with >>>. As far as I know nobody has complained about
that even if it needs more manipulation before you can run the code than
an extra indent.

-- 
Antoon Pardon

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web