referencing the module a piece of code is in

Sean 'Shaleh' Perry shalehperry at home.com
Wed Sep 12 14:50:59 EDT 2001


On 12-Sep-2001 Dan Hitt wrote:
> I'd like to be able to get a reference to a module a piece of
> code is in.
> 

you have seen this before:

if __name__ == '__main__':
        # do work

there is the answer -- __name__ refers to the name of the module.




More information about the Python-list mailing list