Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52286
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'assign': 0.07; 'subject:help': 0.08; 'assigning': 0.09; 'function,': 0.09; 'global,': 0.09; 'subject:question': 0.10; 'def': 0.12; 'declared': 0.16; 'email addr:comcast.net': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'subject:beginner': 0.16; 'variable.': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'print': 0.22; 'header:User-Agent:1': 0.23; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'forgot': 0.30; 'subject: (': 0.35; 'anywhere': 0.35; 'received:84': 0.35; 'but': 0.35; 'var': 0.36; 'thanks': 0.36; 'example,': 0.37; 'being': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'called': 0.40; "you're": 0.61; "you've": 0.63; 'here': 0.66; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'confusing': 0.84; 'reply-to:addr:python.org': 0.84; 'subject:True': 0.91 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.1 cv=ZMDuxxLb c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=0kkAYlmtguIA:10 a=GX7lxCgYsBcA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=oMlm7GkKDYUA:10 a=C_IRinGWAAAA:8 a=v_NmBOS2pk_MlnVuwR8A:9 a=wPNLvfGTeEIA:10 a=si9q_4b84H0A:10 |
| X-AUTH | mrabarnett:2500 |
| Date | Sat, 10 Aug 2013 01:39:47 +0100 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: beginner question (True False help) |
| References | <6c6dedec-5e47-4229-bc67-01b058cdb410@googlegroups.com> <d8ea3662-cab6-4571-87f5-dc82d5c34b8a@googlegroups.com> |
| In-Reply-To | <d8ea3662-cab6-4571-87f5-dc82d5c34b8a@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | python-list@python.org |
| 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.414.1376095190.1251.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1376095190 news.xs4all.nl 15931 [2001:888:2000:d::a6]:36337 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:52286 |
Show key headers only | View raw
On 10/08/2013 00:40, eschneider92@comcast.net wrote: > (I forgot to post this with my last post.) > Also, I don't understand any part of the following example, so there's no specific line that's confusing me. Thanks for the help btw. > You don't understand _any_ of it? > var = 42 Here you're assigning to 'var'. You're not in a function, so 'var' is a global variable. > def myfunc(): > var = 90 Here you're assigning to 'var'. If you assign to a variable anywhere in a function, and you don't say that that variable is global, then it's treated as being local to that function, and completely unrelated to any other variable outside that function. > > print "before:", var > myfunc() > print "after:", var > > def myfunc(): > global var > var = 90 > Here you're assigning to 'var', but this time you've declared that it's global, so you're assigning to the global variable called 'var'.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
beginner question (True False help) eschneider92@comcast.net - 2013-08-07 01:17 -0700
Re: beginner question (True False help) Joshua Landau <joshua@landau.ws> - 2013-08-07 09:42 +0100
Re: beginner question (True False help) eschneider92@comcast.net - 2013-08-07 13:59 -0700
Re: beginner question (True False help) Dave Angel <davea@davea.name> - 2013-08-08 01:18 +0000
Re: beginner question (True False help) Larry Hudson <orgnut@yahoo.com> - 2013-08-07 19:49 -0700
Re: beginner question (True False help) wxjmfauth@gmail.com - 2013-08-07 23:20 -0700
Re: beginner question (True False help) Chris Angelico <rosuav@gmail.com> - 2013-08-08 12:41 +0100
Re: beginner question (True False help) Terry Reedy <tjreedy@udel.edu> - 2013-08-08 16:29 -0400
Re: beginner question (True False help) wxjmfauth@gmail.com - 2013-08-09 01:05 -0700
Re: beginner question (True False help) eschneider92@comcast.net - 2013-08-09 15:27 -0700
Re: beginner question (True False help) Joshua Landau <joshua@landau.ws> - 2013-08-10 00:05 +0100
Re: beginner question (True False help) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-08-09 22:58 -0400
Re: beginner question (True False help) eschneider92@comcast.net - 2013-08-09 15:28 -0700
Re: beginner question (True False help) eschneider92@comcast.net - 2013-08-09 16:14 -0700
Re: beginner question (True False help) Joshua Landau <joshua@landau.ws> - 2013-08-10 00:30 +0100
Re: beginner question (True False help) eschneider92@comcast.net - 2013-08-09 16:24 -0700
Re: beginner question (True False help) eschneider92@comcast.net - 2013-08-09 16:34 -0700
Re: beginner question (True False help) Joshua Landau <joshua@landau.ws> - 2013-08-10 02:22 +0100
Re: beginner question (True False help) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-10 01:40 +0000
Re: beginner question (True False help) eschneider92@comcast.net - 2013-08-09 16:40 -0700
Re: beginner question (True False help) MRAB <python@mrabarnett.plus.com> - 2013-08-10 01:39 +0100
Re: beginner question (True False help) eschneider92@comcast.net - 2013-08-09 16:43 -0700
Re: beginner question (True False help) eschneider92@comcast.net - 2013-08-09 18:08 -0700
csiph-web