[EMAIL PROTECTED] wrote: > I started using Python a couple of days ago - here are a few > questions: > > * Doesn't the __main__() method automatically execute when I run my > python program? > * Only when I do an import of my test.py file within python and then > run test.__main__() I can see where my bugs are. Is this correct? > (right now this is my only way of running my python program and see > where I have problems)
No, there is no special __main__ function, to the best of my knowledge. I think the idiom you're thinking of is: if __name__="__main__": #Your main stuff here But that won't execute if you do an import. Only when you call the script directly, like: python myscript.py for example. > * Once I've done an import and then I wish to make a change to the > file I've imported I have to quit Python, restart and import that > module again in order for the module to be refreshed. Is there no "re- > import" ? There is. The reload command. Usage is similar to import: import MyModule #Do your edit, and reload thusly: reload MyModule > * Finally, could someone tell me why I'm having problems with the > small module below? > - Python pretends I provide chassis_id() with three parameters, even > though I clearly only provide it with two - why? Python expects self as the first parameter. You might want to take another look at the class bits of your tutorial of choice, or: http://docs.python.org/tut/node11.html The function definition should look more like: def chassis_id(self, subtype, chassis_info): HTH. -Jordan Greenberg -- http://mail.python.org/mailman/listinfo/python-list