[Tutor] cannonical matrix representation?

2006-02-10 Thread Mike Cheponis
What's the best way to represent a matrix M with 4 dimensions, such as M[x][y][z][t] where each element in the sparse matrix could be a simple number, or could be an executable Python function snipped that returns a value when that cell is evaluated? The user of the program will type in Python

[Tutor] Simple Tkinter question

2005-10-06 Thread Mike Cheponis
I'm trying to update an Entry's textvariable several times within my Button handler, like so: from Tkinter import * from time import * def my_update(): for i in range(3): tv.set("Now it's %d"%i) sleep(1) root=Tk() tv=StringVar() Entry(textvariable=tv).pack() tv.set("Initial Value o

Re: [Tutor] Combining dictionaries

2005-09-06 Thread Mike Cheponis
On Tue, 6 Sep 2005, Danny Yoo wrote: >> No, that's not what he wants. >> >> He wants c = a + b to work when a and b are dictionaries. >> >> Why is Python broken in such an obvious way? > It might not be obvious. If a and b overlap so that they share keys, then > we might have the following situ

[Tutor] Combining dictionaries

2005-09-06 Thread Mike Cheponis
>Is this what you want ? > >c = dict(a) >c.update(b) > >Pierre >> Is there an easy way to combine dictionaries? >> >> a = {} >> b = {} >> >> a = {'a':'a', 'b':'b', 'c':'c'} >> b = {'1':1, '2':2, '3':3} >> c = a + b # doesn't seem to work >> >> desired: >> c = {'a':'a', 'b':'b', 'c':'c', '1':1,

[Tutor] Case ?

2005-07-05 Thread Mike Cheponis
Why does Python not have a "case" statement, like C? Thanks! -Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor