Question:Programming a game grid ...

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Jun 27 20:15:09 EDT 2012


On Wed, 27 Jun 2012 16:24:30 -0700, David wrote:

> First, you should be getting an error on 
> vars()[var] = Button(f3, text = "00", bg = "white")
> as vars() has not been declared

The Fine Manual says differently:

Python 2:
http://docs.python.org/library/functions.html#vars

Python 3:
http://docs.python.org/py3k/library/functions.html#vars


> and it does not appear to be valid Python syntax.

It's perfectly fine syntax, no different from:

my_dict['spam'] = 'a yummy ham-like substance'

or similar.


-- 
Steven



More information about the Python-list mailing list