[Tutor] Call Attribute error - Was Re: Tutor Digest, Vol 117, Issue 28

Alan Gauld alan.gauld at btinternet.com
Sun Nov 17 16:23:06 CET 2013


On 17/11/13 12:19, Satheesan Varier wrote:
> class myclass():
>          def test(self):
>              print "print this line"
>
> if __name__ == '__main__':
>            myclass.run()
>
> You can do the test run with an instance of that class, as follows:
>
>  >>> k=myclass()
>
>  >>> myclass.test(k)
> print this line

Or more conventionally

k.test()

Please don't post the entire digest when replying, remove any irrelevant 
material. Some people pay by the byte and don't
want to pay for stuff they've already seen.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list