Re: [Tutor] Class attribute error
Hi, Thanks for correcting me. The solutions mentioned by Dominik and Alan have simplified the concept to me now. Regards, Reuben On Sun, Nov 17, 2013 at 5:25 AM, Dominik George wrote: > On Sat, Nov 16, 2013 at 09:13:13AM -0800, reutest wrote: > > class myclass(): > > > > def test(self): > > print "print this line" > > > > > > if __name__ == '__main__': > > myclass.run() > > Is that a question? > > If I were to guess, I'd say you should have asked "Why does this say > that myclass does not havea run method?". Then the simple answer is: > Because, well, it doesn't! Why do you expect it to have one? > > -nik > > -- > Wer den Grünkohl nicht ehrt, ist der Mettwurst nicht wert! > > PGP-Fingerprint: 3C9D 54A4 7575 C026 FB17 FD26 B79A 3C16 A0C4 F296 > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Class attribute error
On 16/11/13 17:13, reutest wrote: class myclass(): def test(self): print "print this line" if __name__ == '__main__': myclass.run() If you have a question it helps if you ask it rather than have us guess. In this case I'm guessing you got an error and you are wondering why? It's because you are calling the run() class method of myclass. And there is no such method. If that's not your question please post again with a bit more of a clue about what you want to know. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Class attribute error
On Sat, Nov 16, 2013 at 09:13:13AM -0800, reutest wrote: > class myclass(): > > def test(self): > print "print this line" > > > if __name__ == '__main__': > myclass.run() Is that a question? If I were to guess, I'd say you should have asked "Why does this say that myclass does not havea run method?". Then the simple answer is: Because, well, it doesn't! Why do you expect it to have one? -nik -- Wer den Grünkohl nicht ehrt, ist der Mettwurst nicht wert! PGP-Fingerprint: 3C9D 54A4 7575 C026 FB17 FD26 B79A 3C16 A0C4 F296 signature.asc Description: Digital signature ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Class attribute error
class myclass(): def test(self): print "print this line" if __name__ == '__main__': myclass.run() -- View this message in context: http://python.6.x6.nabble.com/Class-attribute-error-tp5039199.html Sent from the Python - tutor mailing list archive at Nabble.com. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor