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


Groups > comp.lang.python > #52119 > unrolled thread

beginner question (True False help)

Started byeschneider92@comcast.net
First post2013-08-07 01:17 -0700
Last post2013-08-09 18:08 -0700
Articles 3 on this page of 23 — 10 participants

Back to article view | Back to comp.lang.python


Contents

  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

Page 2 of 2 — ← Prev page 1 [2]


#52286

FromMRAB <python@mrabarnett.plus.com>
Date2013-08-10 01:39 +0100
Message-ID<mailman.414.1376095190.1251.python-list@python.org>
In reply to#52283
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'.

[toc] | [prev] | [next] | [standalone]


#52284

Fromeschneider92@comcast.net
Date2013-08-09 16:43 -0700
Message-ID<67c27dd9-f33b-4445-9df4-433b10850612@googlegroups.com>
In reply to#52119
(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. 

var = 42 
def  myfunc(): 
     var = 90 

print "before:", var 
myfunc() 
print "after:", var 

def myfunc(): 
    global var 
    var = 90 

[toc] | [prev] | [next] | [standalone]


#52288

Fromeschneider92@comcast.net
Date2013-08-09 18:08 -0700
Message-ID<46446a7f-f5e4-411e-9eb5-acd619dcad7a@googlegroups.com>
In reply to#52119
I'm sorry, but I still don't understand how it applies to my problem. Thanks for everyone's patience.

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.python


csiph-web