Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'completeness': 0.07; 'works.': 0.07; 'python': 0.09; 'etc).': 0.09; 'nameerror:': 0.09; 'received:155': 0.09; 'def': 0.10; '"new': 0.16; '24,': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'received:155.180': 0.16; 'received:159.53': 0.16; 'received:159.53.110': 0.16; 'received:bankone.net': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'received:svr.bankone.net': 0.16; 'run.': 0.16; 'say.': 0.16; 'securities,': 0.16; 'too?': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'to:name:python-list@python.org': 0.20; 'trying': 0.21; 'do.': 0.21; 'error.': 0.21; 'java': 0.21; 'defined': 0.22; 'work.': 0.23; '15,': 0.23; 'received:169.254': 0.24; 'second': 0.24; 'header:In-Reply-To:1': 0.25; 'values': 0.26; '(most': 0.27; 'question': 0.27; 'accuracy': 0.27; 'received:169': 0.29; '"the': 0.29; 'code': 0.31; 'file': 0.32; 'could': 0.32; 'print': 0.32; 'traceback': 0.33; 'to:addr:python- list': 0.33; 'languages': 0.33; 'there': 0.35; 'really': 0.36; 'charset:us-ascii': 0.36; 'enough': 0.36; 'does': 0.37; 'two': 0.37; 'why': 0.37; 'moment': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'shows': 0.38; 'to:addr:python.org': 0.39; 'help': 0.40; 'your': 0.60; 'lost': 0.60; 'skip:n 10': 0.63; 'information,': 0.63; 'url:email': 0.63; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'manner': 0.74; 'sale': 0.76; 'received:169.254.8': 0.84; 'deal,': 0.93 X-DKIM: OpenDKIM Filter v2.1.3 sj1.jpmchase.com q73FUrP0013344 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1344007853; bh=CdfvIf6XCr7N+ehUsKYjzonNUmD+PYgmO/Oz/PKQLSI=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=fD2e4Pt5qXxWrAZojNtTZgU+egFjhv5iaYS/qBim1rVtXOTP6YFbRjDrNWMhEkewS 6UE6uYLGkh3/zm0uF7OFZP9P47Dsij3HMyzpbnkX73M2vYMsoXZxD99J8QETs+kEMH M7gHRYp2ZNxFoCznoQxcy1cUrkIT5VRKpM7FWfZI= From: "Prasad, Ramit" To: "python-list@python.org" Subject: RE: Calling Values Thread-Topic: Calling Values Thread-Index: AQHNcW7VBs0ox8ge90qUJzdZfp2XPpdIa4+A///JdbA= Date: Fri, 3 Aug 2012 15:30:41 +0000 References: <8bdc29d5-fa88-4ead-a4a1-135d708eeb57@googlegroups.com> <21f0980d-10dc-4970-bace-8e909994fafd@googlegroups.com> In-Reply-To: <21f0980d-10dc-4970-bace-8e909994fafd@googlegroups.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.67.79.47] Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-DLP-FWD: Yes Content-Type: text/plain; charset="us-ascii" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1344007857 news.xs4all.nl 6923 [2001:888:2000:d::a6]:41934 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26440 =0D=0A> def func1():=0D=0A> =0D=0A> num1=3D10=0D=0A> =0D=0A> num2=3D20= =0D=0A> =0D=0A> print "The Second Number is:",num2=0D=0A> =0D=0A> retur= n=0D=0A> =0D=0A> =0D=0A> def func2():=0D=0A> =0D=0A> func1()=0D=0A>= num3=3Dnum1+num2=0D=0A> =0D=0A> num4=3Dnum3+num1=0D=0A> =0D=0A> print = "New Number One is:",num3=0D=0A> =0D=0A> print "New Number Two is:",num4= =0D=0A> =0D=0A> =0D=0A> This works=2E Even you can incoportate some conditi= onals over func1() in func2()=0D=0A> and run=2E=0D=0A=0D=0AThis does not wo= rk=2E Python does not get "compiled" in the same manner=0D=0Aas other langu= ages (C, Java etc)=2E Since you never call func2(), there is no=0D=0Aerror= =2E Once you try calling func2() you will see it does not work=2E func1()= =0D=0Adoes work=2E=0D=0A=0D=0AThe Second Number is: 20=0D=0ATraceback (most= recent call last):=0D=0A File "subha=2Epy", line 24, in =0D=0A = func2()=0D=0A File "subha=2Epy", line 15, in func2=0D=0A num3=3Dnum1+n= um2=0D=0ANameError: global name 'num1' is not defined=0D=0A=0D=0A> My quest= ion can I call its values of func1() too?=0D=0A> What it is the big deal in= experimenting we may come up with some new code or=0D=0A> a new need?=0D= =0A=0D=0AIt is not a big deal, that is how you learn=2E You are just writin= g code that=0D=0Aneither works nor really shows enough to tell us why or wh= at you are trying =0D=0Ato do=2E Not much I can do to guide or help you bec= ause I am completely lost=0D=0Aat your goal=2E The best I can do at the mom= ent is say=2E func2 will not work=2E=0D=0AYou could return num1 and num2 fr= om func1() and then it would work=2E=0D=0A=0D=0Adef func1():=0D=0A num1=3D= 10=0D=0A num2=3D20=0D=0A print "The Second Number is:",num2=0D=0A return= num1, num2=0D=0A=0D=0A=0D=0Adef func2():=0D=0A num1, num2 =3D func1(= )=0D=0A num3=3Dnum1+num2=0D=0A num4=3Dnum3+num1=0D=0A print "New Number On= e is:",num3=0D=0A print "New Number Two is:",num4=0D=0A=0D=0A =0D=0Afunc= 2()=0D=0A=0D=0ARamit=0D=0AThis email is confidential and subject to importa= nt disclaimers and=0D=0Aconditions including on offers for the purchase or = sale of=0D=0Asecurities, accuracy and completeness of information, viruses,= =0D=0Aconfidentiality, legal privilege, and legal entity disclaimers,=0D=0A= available at http://www=2Ejpmorgan=2Ecom/pages/disclosures/email=2E