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: 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: References: Date: Thu, 28 Jun 2012 09:35:59 +1000 Subject: Re: Question:Programming a game grid ... From: Chris Angelico 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Thu, Jun 28, 2012 at 9:24 AM, David 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