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: 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: References: <95e88ca6-36ad-4820-8ecc-c9a788517430@googlegroups.com> Date: Mon, 24 Sep 2012 20:06:41 -0400 Subject: Re: which a is used? From: Dwight Hutto To: Jayden 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Mon, Sep 24, 2012 at 7:57 PM, Dwight Hutto wrote: > On Mon, Sep 24, 2012 at 7:43 PM, Jayden 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