Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.109.133.81.MISMATCH!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.025 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'attribute': 0.07; 'class,': 0.07; '__name__': 0.09; 'inherited': 0.09; 'val': 0.09; 'python': 0.11; 'def': 0.12; '"created': 0.16; "'__main__':": 0.16; 'attributes.': 0.16; 'class)': 0.16; 'instance"': 0.16; 'subject:Accessing': 0.16; 'subject:class': 0.16; 'saying': 0.22; 'print': 0.22; 'error': 0.23; 'skip:" 20': 0.27; 'correct': 0.29; "i'm": 0.30; '(which': 0.31; 'code': 0.31; 'class': 0.32; 'skip:_ 10': 0.34; 'there': 0.35; 'accessing': 0.36; 'wrong': 0.37; 'to:addr:python-list': 0.38; 'expect': 0.39; 'to:addr:python.org': 0.39; 'changed': 0.39; 'skip:p 20': 0.39; 'new': 0.61; 'here': 0.66; 'from:addr:yahoo.co.in': 0.68; 'received:106': 0.68; 'received:106.10': 0.68; 'received:106.10.166': 0.68; 'received:bullet.mail.sg3.yahoo.com': 0.68; 'received:mail.sg3.yahoo.com': 0.68; 'received:sg3.yahoo.com': 0.68; 'received:106.10.151': 0.84; ',please': 0.91 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 257250.46179.bm@omp1021.mail.sg3.yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.in; s=s1024; t=1378966548; bh=wRP/DcYsORSncw+5dfR39rs1VNhGpya9pREmD4/8+sg=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=FSKbQHjpl9iOUcveBAwKq33Pp/6XJdm08i4LsuK0qzJfXHcMAxXB2PUboRSZ2Pb0CXoH5m5p2MDUIgzIuAaAUGsSjZS6GNLlLOM8vJRqw5vku/MwB7degzJdurolBDMad5P6L1vZ0/33NSBFpXslGrtc6NtGzy4ztNM/mX3EyrY= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=B3oZWs4jwYmYpMMs7/K6xYtScabdLLub/fo1cmJi4LpMiulbJVg3ln0VZkjP6U3xou3/japKN1D+hZqL5qYDoUaS6p35Szi5SeSlBQm6S2w1Re6On1U6L+NrfcF+pl69nnSwZYf5f0h6zF7z/rtMHAniI2e5C6fryv0C+SY5s0U=; X-YMail-OSG: QygeXiAVM1lv1IkCfqI59fq0s7g8OzzK0.mf2dCJSGa7egn QqbN9AQCShd4bTHwJmQO83WJkmhvDZOgK5sdI1h9v2NTynCm8uBzeUaLRBqF W344Zugxe93fRE0dBS87KJ6X8ue2_mJwT4i4rUprp9ewRHVf5krr9OH7uscl vLkVqjBi1EVeoMblQbnw35vbu0x7Fipoo2pnVYZbz0Zu5MavScXbqKEu6QHf OSpcfmpGA4YfhG0yn2CEbuZWdddJlGtIFITg_HVBODTEKtcXwHrCHBw25Lw3 5cpc4G4Yr7miiNN4.CbUCZ.f0KTuOBDCOXih8gUXBa9PaDBH_R_LmLWkICOp 83lIMcigb7YPi_Ky1NIFY9cT.zK0iTIHyFpXUzbMX1DG2JmYXivfMNM4rN16 AwTmtS.26sF65m_XV7Np9_YWTwsNiRHxSIjRih9se0Qj2Hp5XyHqun75Ha1r DPaQ4wHYQI0WV_IQESZM1DrMQEaKtEYsOKH3mdZbmwtYnKOEa2z97WiOeZpg WKtWGbhn3yzCExxybnc9wmdI9aVjtnZaQFoQIPfbP8mlNgpD9X_I- X-Rocket-MIMEInfo: 002.001, SGkgLA0KDQpJJ20gbmV3IHRvIHB5dGhvbiAscGxlYXNlIGNvcnJlY3QgbWUgaWYgdGhlcmUgaXMgYW55IHRoaW5nIHdyb25nIHdpdGggdGhlIHdheSBhY2Nlc3NpbmcgY2xhc3MgYXR0cmlidXRlcy4NCg0KUGxlYXNlIHNlZSB0aGUgYmVsb3cgY29kZSAuSSBoYXZlIGluaGVyaXRlZCBjb25maWQgaW4gRXhwZWN0SWQgY2xhc3MsIGNoYW5nZWQgc2VsZi5wcmludF9tc2cgIHRvIEhlbGxvLiBOb3cgIGluaGVyaXRlZCBjb25maWQgaW4gVGVzdHByaW50bXNnSUQgY2xhc3MuTm93ICBJIHdhbnRlZCB0byBwcmludCABMAEBAQE- X-Mailer: YahooMailClassic/328 YahooMailWebService/0.8.156.576 Date: Thu, 12 Sep 2013 14:15:47 +0800 (SGT) From: chandan kumar Subject: Accessing class attribute To: python-list@python.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: 45 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1378966730 news.xs4all.nl 15953 [2001:888:2000:d::a6]:37129 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:54037 Hi , I'm new to python ,please correct me if there is any thing wrong with the w= ay accessing class attributes. Please see the below code .I have inherited confid in ExpectId class, chang= ed self.print_msg to Hello. Now inherited confid in TestprintmsgID class.= Now I wanted to print self.print_msg value (which is changed under ExpectI= d class) as Hello under TestprintmsgID. I end up with error saying Testpri= ntmsgID has no attribute self.print_msg. Atleast i expect the null to be p= rinted. class confid(): def __init__(self): self.print_msg =3D "" class ExpectId(confid): =20 def __init__(self): self.print_msg =3D " Hello" def expectmethod(self): print "self.print_mesg =3D ",self.print_msg class TestprintmsgID(confid): =20 =20 def __init__(self): "Created Instance" def printmsgmethod(self): print "printmsgmethod print_msg val =3D ",self.print_msg---- Here i= s the Attribute error if __name__ =3D=3D '__main__': ins1 =3DExpectId() ins1.expectmethod() ins2 =3D TestprintmsgID() ins2.printmsgmethod() Best Regards, Chandan