[Tutor] using -i flag with '''if __name__ == "__main__":'''
jfouhy@paradise.net.nz
jfouhy at paradise.net.nz
Wed May 18 00:40:12 CEST 2005
Quoting Terry Carroll <carroll at tjc.com>:
> I've recently started using the construct
>
> if __name__ == "__main__":
> main()
>
> And found I can't do the -i thing effectively any more. What's a good
> equivalent approach?
If main is a class, you could change to 'm = main()'; that would at least give
you access to the class attributes.
Another possibility is to look at this recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65287
--
John.
More information about the Tutor
mailing list