[Tutor] Exiting a PyGTK main loop

2008-09-19 Thread Bart Cramer
Dear all, I am a bit stuck in a small project, trying to quit a PyGTK program. Here are some relevant snippets: def init_gui (self) : self.window = gtk.Window (gtk.WINDOW_TOPLEVEL) self.window.connect ("delete_event", self.

[Tutor] __init__, default values and dict's

2008-08-14 Thread Bart Cramer
Dear tutors, I have the following code snippet: class N (object) : def __init__ (self, d={}) : self.d = d n1 = N () n1.d['a'] = 1 n2 = N () n2.d['a'] = 2 print n1.d['a'] print n2.d['a'] I assumed that on each call of the __init__ without a dictionary p

[Tutor] Memory consumption question

2007-11-15 Thread Bart Cramer
? The funny thing is, when I put these things into an array of length, say, a million, it turns out that class A eats about 184 bytes per instantiation, and class B a lot less (sic!): plm 50 bytes. How come? Best, Bart. -- Bart Cramer Dudweilerstrasse 31 66111 Saarbrucken, Germany 0049 1577 680