Class vrs. function

Bob van der Poel bvdpoel at uniserve.com
Sat Jul 1 13:02:29 EDT 2000


I see sample code for python/tkinter which looks like this:

	class main:
		def __init__(self):
			...do a bunch of init stuff

	a=main()
	root.mainloop()

What I'm wonder is why the use of a class for this. Wouldn't it be just
as clear and perhaps more efficient to do

	...do init stuff
	root.mainloop()

Is this just a good habit being developed by those who think that
classes are better than functions, or god forbid, inline code?

While I'd asking, are there any penalties in the speed/memory usage
departments on using classes vrs. functions?

In case this isn't obvious I'm an old programmer who figured that C was
a really nice, almost-cross-platform assembly language....

-- 
   __
  /  )      /         Bob van der Poel
 /--<  ____/__        bvdpoel at uniserve.com
/___/_(_) /_)         http://users.uniserve.com/~bvdpoel




More information about the Python-list mailing list