Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #24573

Re: Question:Programming a game grid ...

From woooee@gmail.com
Newsgroups comp.lang.python
Subject Re: Question:Programming a game grid ...
Date 2012-06-27 19:15 -0700
Organization http://groups.google.com
Message-ID <5f203d38-5595-46af-85aa-ba8aeeb46c25@googlegroups.com> (permalink)
References <Np-dnS8nJLnEGnbSnZ2dnUVZ_tCdnZ2d@giganews.com> <ef9b442a-f4f4-4f86-b3a6-5546254ca327@googlegroups.com> <4feba20d$0$29866$c3e8da3$5496439d@news.astraweb.com>

Show all headers | View raw


On Wednesday, June 27, 2012 5:15:09 PM UTC-7, Steven D&#39;Aprano wrote:
> 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

"as vars() has not been declared and it does not appear to be valid Python syntax"

You assume too much IMHO.  Vars() was not declared in the code provided and I do not think that we should be assuming that it is a function returning a dictionary instead of an error.  Just my opinion.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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