[IPython-dev] GUI support: conflicts between IPython 0.11 and Matplotlib/ETS

Hans Meine hans_meine at gmx.net
Fri Feb 12 05:08:18 EST 2010


Hi Gaël,

On Friday 12 February 2010 11:02:52 you wrote:
> On Fri, Feb 12, 2010 at 10:42:32AM +0100, Hans Meine wrote:
> > Huh?  Honestly, why should applications modify their __main__ to check
> > for *existing* global objects -
> 
> Because nobody should code thinking they own the main. It makes debugging
> and reusing much harder.

But I am thinking of mains like the following:

if __name__ == "__main__":
	import sys

	app = QtGui.QApplication(sys.argv)

	mw = BeverageMainWindow()
	mw.resize(800, 600)
	mw.show()
	sys.exit(app.exec_())

This is a prototypical __main__ which I'd like to be able to %run from IPython 
as well as from the commandline.  If I want to reuse code, I'll import the 
file and reuse BeverageMainWindow, but not the __main__ code.

> That's my point of view, and it comes from a long experience of trying to
> help people run code, debug code, or simply get the job done using third
> party code.

Maybe then those people put too much code into __main__?

Have a nice day,
  Hans



More information about the IPython-dev mailing list