[Tutor] Main program confusion

Luke Paireepinart rabidpoobear at gmail.com
Mon Feb 19 17:52:21 CET 2007


Hazlett, Les wrote:
>
> Hello,
>
> I am trying to understand some sample code that includes the following 
> for a main program:
>
> def runTest(frame, nb, log):
>
> win = TestPanel(nb, log)
>
> return win
>
> if __name__ == '__main__':
>
> import sys,os
>
> import run
>
> run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
>
> I understand that win is an object of the class TestPanel. The class 
> code for TestPanel preceded
>
> the code which I copied above. The object win clearly is instantiated. 
> I understand how the
>
> if__name__==’__main__’ only runs when this program file is executed.
>
> But, I can’t find any reference to a module run and I don’t see how 
> the “run.main([“ line casues
>
> the “runTest(“ function to run.
>
I've never heard of this module. Where did this code come from?
Have you tried the code? Either run is some builtin I haven't heard of, 
or the code is in some library/turorial that defines a custom module.
-Luke
>
> What am I missing?
>
> Thanks for any help.
>
> Les Hazlett
>
> ------------------------------------------------------------------------
> The information contained in this communication may be CONFIDENTIAL 
> and is intended only for the use of the recipient(s) named above. If 
> you are not the intended recipient, you are hereby notified that any 
> dissemination, distribution, or copying of this communication, or any 
> of its contents, is strictly prohibited. If you have received this 
> communication in error, please notify the sender and delete/destroy 
> the original message and any copy of it from your computer or paper 
> files.
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>   



More information about the Tutor mailing list