[Python-ideas] Replacing the if __name__ == "__main__" idiom (was Re: making a module callable)

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Nov 24 04:35:20 CET 2013


Haoyi Li wrote:
> Import hooks don't work with __main__ =( I spent a while trying to get 
> it to work when working on MacroPy, to no avail.

It's hard to see how they could. How would you *install*
an import hook before __main__ got imported?

-- 
Greg


More information about the Python-ideas mailing list