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


Groups > comp.lang.python > #29972

Re: which a is used?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feed.xsnews.nl!border-3.ams.xsnews.nl!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <dwightdhutto@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'value,': 0.03; 'received :mail-vb0-f46.google.com': 0.09; 'sep': 0.09; 'cc:addr:python- list': 0.10; 'def': 0.10; '24,': 0.16; 'assigns': 0.16; 'lot!': 0.16; 'subject:which': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'received:209.85.212.46': 0.18; 'all,': 0.21; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'in.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; 'prints': 0.29; 'url:mailman': 0.29; 'class': 0.29; 'function': 0.30; 'code': 0.31; 'url:python': 0.32; 'print': 0.32; 'url:listinfo': 0.32; 'received:google.com': 0.34; 'thanks': 0.34; 'follows:': 0.35; 'pm,': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'url:org': 0.36; "wasn't": 0.36; "didn't": 0.36; 'should': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'shows': 0.38; 'where': 0.40; 'header:Received:5': 0.40; 'url:mail': 0.40; 'think': 0.40; 'show': 0.63; 'results': 0.65; '20,': 0.65; 'dear': 0.66; 'why?': 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 :cc:content-type; bh=yYdLLBNQOFlpCz+L5E16vwY6tzMEn1n5JkZTa22Zl8c=; b=P4D9v2c/B8U8qm6sFeoSB5mvrZH5xsHy+uh/GdUr5cn67DGDwkulHEq828sozSnR9m tQSsBCbXZiVydau52f93xydFwVCoQrecbZxHbP3WOtJr4NyqKwHAyS0RkMph6EnjdJmf pjoY8cyXCPjMeFCg/3fKmKBbQ+F+WkjWBABmtslUZyQ3PakGZizO9efLqVQQRzIJy5g6 0a9w5XOZAuTz0yB7b09HALBE0LFJOlWB4t9Rv/36t7ZnW4RsDilL4sWLdXYuEB81NkCr laO+3o1B4k4/sGgPqcA2adG8QodAYRSrjJ8AUh2LMV0fMVITw+MUhzIYUJmrSIzghec9 gB1g==
MIME-Version 1.0
In-Reply-To <CA+vVgJW8-=Z880fyLYT23cV-=9CiTepX6f5Cjy8d7cT3BZ9SSQ@mail.gmail.com>
References <95e88ca6-36ad-4820-8ecc-c9a788517430@googlegroups.com> <CA+vVgJW8-=Z880fyLYT23cV-=9CiTepX6f5Cjy8d7cT3BZ9SSQ@mail.gmail.com>
Date Mon, 24 Sep 2012 20:06:41 -0400
Subject Re: which a is used?
From Dwight Hutto <dwightdhutto@gmail.com>
To Jayden <jayden.shui@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
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.1248.1348531603.27098.python-list@python.org> (permalink)
Lines 50
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348531603 news.xs4all.nl 6843 [2001:888:2000:d::a6]:45318
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29972

Show key headers only | View raw


On Mon, Sep 24, 2012 at 7:57 PM, Dwight Hutto <dwightdhutto@gmail.com> wrote:
> On Mon, Sep 24, 2012 at 7:43 PM, Jayden <jayden.shui@gmail.com> wrote:
>> Dear All,
>>
>> I have a simple code as follows:
>>
>> # Begin
>> a = 1
>>
>> def f():
>>     print a
>>
>> def g():
>>     a = 20
>>     f()

this prints a from calling f() function

call print a wasn't in a class where it was self.a and changed, so it
performed the function f which prints a and a = 1, but g just assigns
the 20, and calls the f() function which shows a, there is no self.a,
nor a class to show this in.



>>
>> g()
>> #End
>>
>> I think the results should be 20, but it is 1. Would you please tell me why?
>>
>> Thanks a lot!
>>
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>
> didn't return the value, or print it out
>
>
> --
> Best Regards,
> David Hutto
> CEO: http://www.hitwebdevelopment.com



-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com

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


Thread

which a is used? Jayden <jayden.shui@gmail.com> - 2012-09-24 16:43 -0700
  Re: which a is used? Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 19:57 -0400
  Re: which a is used? Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 20:06 -0400
  Re: which a is used? alex23 <wuwei23@gmail.com> - 2012-09-24 17:08 -0700
    Re: which a is used? Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 21:13 -0400
      Re: which a is used? alex23 <wuwei23@gmail.com> - 2012-09-24 19:14 -0700
        Re: which a is used? Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 22:37 -0400
          Re: which a is used? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-25 07:07 +0200
            Re: which a is used? Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-25 01:30 -0400
              Re: which a is used? alex23 <wuwei23@gmail.com> - 2012-09-25 05:48 -0700
            Re: which a is used? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-25 08:44 +0100
            Stop feeding the trolls (Was: which a is used?) D'Arcy Cain <darcy@druid.net> - 2012-09-25 09:53 -0400
            Re: Stop feeding the trolls (Was: which a is used?) David Robinow <drobinow@gmail.com> - 2012-09-25 21:00 -0400
            Re: Stop feeding the trolls (Was: which a is used?) Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-26 03:06 -0400
              Re: Stop feeding the trolls (Was: which a is used?) alex23 <wuwei23@gmail.com> - 2012-09-26 17:40 -0700
                Re: Stop feeding the trolls Ben Finney <ben+python@benfinney.id.au> - 2012-09-27 13:06 +1000
                Re: Stop feeding the trolls Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-27 23:39 -0400
                Re: Stop feeding the trolls (Was: which a is used?) Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-27 23:47 -0400
                Re: Stop feeding the trolls (Was: which a is used?) Chris Angelico <rosuav@gmail.com> - 2012-09-28 14:40 +1000
                Re: Stop feeding the trolls (Was: which a is used?) Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-28 00:50 -0400
                Re: Stop feeding the trolls (Was: which a is used?) "Littlefield, Tyler" <tyler@tysdomain.com> - 2012-09-27 23:12 -0600
                Re: Stop feeding the trolls (Was: which a is used?) Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-28 01:21 -0400
                Re: Stop feeding the trolls (Was: which a is used?) rusi <rustompmody@gmail.com> - 2012-09-27 22:51 -0700
                Re: Stop feeding the trolls (Was: which a is used?) Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-28 02:20 -0400
            Re: Stop feeding the trolls (Was: which a is used?) Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-26 03:07 -0400
        Re: which a is used? "Colin J. Williams" <cjw@ncf.ca> - 2012-09-25 08:52 -0400
      Re: which a is used? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-25 07:06 +0200
        Re: which a is used? Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-25 01:22 -0400
          Re: which a is used? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-25 07:39 +0200
    Re: which a is used? Terry Reedy <tjreedy@udel.edu> - 2012-09-25 01:05 -0400
  Re: which a is used? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-25 01:18 +0000
    Re: which a is used? Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 21:47 -0400
      Re: which a is used? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-25 07:06 +0200
    Re: which a is used? Dwight Hutto <dwightdhutto@gmail.com> - 2012-09-24 21:50 -0400
  Re: which a is used? Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2012-09-25 11:30 +0200

csiph-web