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


Groups > comp.lang.python > #24562

Re: Question:Programming a game grid ...

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'argument': 0.04; 'function,': 0.07; 'level,': 0.07; 'subject:Question': 0.07; 'python': 0.09; 'behave': 0.09; 'differently.': 0.09; 'dictionary,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'relied': 0.16; 'subject:Programming': 0.16; 'syntax,': 0.16; 'syntax.': 0.16; 'written.': 0.16; 'wrote:': 0.17; 'thu,': 0.17; 'module': 0.19; 'versions': 0.20; 'received:209.85.214.174': 0.21; 'assignment': 0.22; 'header:In- Reply-To:1': 0.25; 'appear': 0.26; 'am,': 0.27; 'first,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'declared': 0.29; 'read,': 0.29; 'function': 0.30; 'error': 0.30; 'url:python': 0.32; 'could': 0.32; 'getting': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'text': 0.34; 'received:209.85': 0.35; 'but': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'should': 0.36; 'possible': 0.37; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'subject:...': 0.63; 'legal': 0.65; 'subject::': 0.83; 'subject: ...': 0.84; 'url:functions': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Rqhnu0PBU+9LvgLWI7GVegMDKyromLZYYXUDDZb9wEc=; b=aGNTmjSuU1hZVVHNWk2+PQjEZNB3pqkMGB4LjGRAwuxmPrSoec01Be6jI5zdBsRUoJ MJYBQ82RDjEUqdiZOF7tcmPmtambv7wDcH7v8gbiX0J+GpamuIMj8LZQdnHGclAfPBCP DiXnMv5h38/lpBc3SkSU3JD6R5Eoy+WHLzcJwYVm8rKIgYf+w/mi0bTrxLL0aLeoE/y6 ZUazylTeX3pwlm2cmlKxjUorV9dCjSilfjOIG7JxJIWv2bBYIlfFaDIkUoXmOZUUFu4Q 76nRlrIY5ArwH3/QGncdlxf9WeaAOEoT8+h2vTLbAfob/BREXiwfNsZ5KYUXIppp3ZJZ BBDQ==
MIME-Version 1.0
In-Reply-To <ef9b442a-f4f4-4f86-b3a6-5546254ca327@googlegroups.com>
References <Np-dnS8nJLnEGnbSnZ2dnUVZ_tCdnZ2d@giganews.com> <ef9b442a-f4f4-4f86-b3a6-5546254ca327@googlegroups.com>
Date Thu, 28 Jun 2012 09:35:59 +1000
Subject Re: Question:Programming a game grid ...
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1573.1340840162.4697.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1340840162 news.xs4all.nl 6894 [2001:888:2000:d::a6]:54601
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:24562

Show key headers only | View raw


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 | 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