Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #24562
| References | <Np-dnS8nJLnEGnbSnZ2dnUVZ_tCdnZ2d@giganews.com> <ef9b442a-f4f4-4f86-b3a6-5546254ca327@googlegroups.com> |
|---|---|
| Date | 2012-06-28 09:35 +1000 |
| Subject | Re: Question:Programming a game grid ... |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1573.1340840162.4697.python-list@python.org> (permalink) |
On Thu, Jun 28, 2012 at 9:24 AM, David <dwblas@gmail.com> wrote: > First, you should be getting an error on > vars()[var] = Button(f3, text = "00", bg = "white") > as vars() has not been declared and it does not appear to be valid Python syntax. It's valid syntax, but highly inadvisable. What it does is call the vars() function, then dereference its argument for assignment - perfectly legal when the function returns a dictionary, which vars does. But check the docs: http://docs.python.org/library/functions.html#vars It's intended to be read, NOT written. It's entirely possible that this works at module level, but should not be relied on. Also, other Python implementations or even other versions of the same Python could behave differently. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Question:Programming a game grid ... iconoclast011 <iconoclast011@gmail.com> - 2012-06-27 17:21 -0500
Re: Question:Programming a game grid ... David <dwblas@gmail.com> - 2012-06-27 16:24 -0700
Re: Question:Programming a game grid ... Chris Angelico <rosuav@gmail.com> - 2012-06-28 09:35 +1000
Re: Question:Programming a game grid ... Chris Angelico <rosuav@gmail.com> - 2012-06-28 09:37 +1000
Re: Question:Programming a game grid ... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-06-28 00:15 +0000
Re: Question:Programming a game grid ... woooee@gmail.com - 2012-06-27 19:15 -0700
Re: Question:Programming a game grid ... alex23 <wuwei23@gmail.com> - 2012-06-27 19:43 -0700
Re: Question:Programming a game grid ... iconoclast011 <iconoclast011@gmail.com> - 2012-06-27 21:59 -0500
Re: Question:Programming a game grid ... Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-06-28 02:08 -0400
Re: Question:Programming a game grid ... Temia Eszteri <lamialily@cleverpun.com> - 2012-06-27 20:03 -0700
Re: Question:Programming a game grid ... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-06-28 04:39 +0000
Re: Question:Programming a game grid ... MRAB <python@mrabarnett.plus.com> - 2012-06-28 00:43 +0100
Re: Question:Programming a game grid ... alex23 <wuwei23@gmail.com> - 2012-06-27 17:31 -0700
Re: Question:Programming a game grid ... Rick Johnson <rantingrickjohnson@gmail.com> - 2012-06-27 21:04 -0700
csiph-web