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


Groups > comp.lang.python > #45245

Re: global variable not working inside function. Increment

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <prvs=838e011f4=jeanmichel@sequans.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.180
X-Spam-Level *
X-Spam-Evidence '*H*': 0.65; '*S*': 0.00; 'subject:not': 0.03; 'cc:addr:python-list': 0.11; 'python': 0.11; 'behavior,': 0.16; 'grasp': 0.16; 'subject:variable': 0.16; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'tutorials': 0.26; 'header:In-Reply-To:1': 0.27; "i'm": 0.30; 'url:mailman': 0.30; 'code': 0.31; 'probably': 0.32; 'covered': 0.32; 'url:python': 0.33; 'could': 0.34; 'but': 0.35; 'url:listinfo': 0.36; 'possible': 0.36; 'url:org': 0.36; 'thank': 0.38; 'fact': 0.38; 'anything': 0.39; 'heard': 0.39; 'called': 0.40; 'url:mail': 0.40; 'read': 0.60; 'you.': 0.62; 'information': 0.63; 'received:194': 0.64; 'to:addr:gmail.com': 0.65; 'subject:. ': 0.67; 'contact': 0.67; 'notice:': 0.67; 'person,': 0.68; 'privileged.': 0.69; 'disclose': 0.74; 'afford': 0.91; 'medium.': 0.91
X-IronPort-AV E=Sophos;i="4.87,663,1363129200"; d="scan'208";a="1455324"
X-Virus-Scanned amavisd-new at zimbra.sequans.com
Date Mon, 13 May 2013 17:07:41 +0200 (CEST)
From Jean-Michel Pichavant <jeanmichel@sequans.com>
To "feather.duster.kung.fu" <feather.duster.kung.fu@gmail.com>
In-Reply-To <688b6146-4601-47a7-8418-5fbc28650307@googlegroups.com>
Subject Re: global variable not working inside function. Increment
MIME-Version 1.0
X-Mailer Zimbra 7.2.2_GA_2852 (ZimbraWebClient - GC7 (Linux)/7.2.2_GA_2852)
Content-Type text/plain; charset="utf-8"
Content-Transfer-Encoding base64
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.1628.1368457664.3114.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1368457664 news.xs4all.nl 15964 [2001:888:2000:d::a6]:58266
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45245

Show key headers only | View raw


> Thank You for setting that straight. I'm just learning Python and
> NONE of the tutorials I read said anything about that . In fact they
> all say a global can be called from inside a Function. If possible
> please contact the ppl that write these things.....I've heard of
> Ocam's razor but not Hanlon's???
> --
> http://mail.python.org/mailman/listinfo/python-list

It's covered by this one:
http://docs.python.org/2/tutorial/classes.html#python-scopes-and-namespaces

It's flagged as a quirk python behavior, and probably could afford a code sample, it can be difficult to grasp from the formal description.

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

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


Thread

Re: global variable not working inside function. Increment Jean-Michel Pichavant <jeanmichel@sequans.com> - 2013-05-13 17:07 +0200

csiph-web