Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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: UNSURE 0.392 X-Spam-Level: *** X-Spam-Evidence: '*H*': 0.39; '*S*': 0.17; 'subject:Python': 0.06; 'def': 0.12; 'subject:variable': 0.16; 'all,': 0.19; 'print': 0.22; 'to:2**1': 0.27; "i'm": 0.30; 'code': 0.31; 'getting': 0.31; 'method': 0.36; 'to:addr:python-list': 0.38; 'explain': 0.39; 'to:addr:python.org': 0.39; 'different': 0.65; 'from:addr:yahoo.co.in': 0.68; 'received:106': 0.68; 'received:106.10': 0.68; 'received:106.10.166': 0.68; 'received:bullet.mail.sg3.yahoo.com': 0.68; 'received:mail.sg3.yahoo.com': 0.68; 'received:sg3.yahoo.com': 0.68; 'received:106.10.151': 0.84; 'verifying': 0.84; 'subject:Global': 0.91 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 753450.73940.bm@omp1030.mail.sg3.yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.in; s=s1024; t=1377510840; bh=56eDMYGI6s8pvPxQCoHIAizsyKc+69NpO0fwi+jvmG8=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=kKojXewQLxDhCymTAVIw4QkPguDj9a4L8je/ZtN3+tBBAyQiI30aho43lWHJM2KymEx6t4TzUNuoWqpKBOCY0DN3KocEUbhYvoaia6XYKsldyrXTELVMdkT5H0/0bjnUqZF7zPv1yU9t04ViknasUkUYwOZExZnavEdp8dYttfo= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=uhqaxidLQk7E1uapRUsYQOMo+GS5/0Fl3kJ2xsjzyxTzUHezblTwgZNR/++uwLWOQa4+9BO2TZcZ4lW227yxJhcvLVl7WSdSkYx8S7/m6u/j1R4qLYJhIlY7sZWyIOsuoFJ37t8tBtlPdUiAFXfa82LlP8UWIcwjcv23jGkaXj4=; X-YMail-OSG: mXgZ9ZMVM1mr6WJOZfhYe_.5iDJXnmqMcFSdmtl5iXVQ4.F rvKgUKDCUDsiGhYhIn0CKJ_7QcH_hDlcO..6ILDWEnsJJru6QXJndf7nAupF NbUXzob.1Kcl_8239GczX6f6TtWVOQ8EKNacvRYwsUdVp0pUOAMkUlfXtJvg 2XXDX0KoWHH_5gFZEtO9kDjMouJaCTaRGb1ptDm1O0vMAvrM3apDr1H.jeyF ItamaDnGacUlJ8oO2Xx7uiuPWjFuo7d9To8lqLtoke8k7p6jOrMF6ARljJqr Tr8tr6CoB84TNQofvNg89DzmKK6Z7Sba7f9p.Dwa50Wd4E8e0j7_icL4JXBs P1_48RYtk_dY7thHYakIuXc820LoYCEuNhD0X9Q_R55krck3T5RmV03ffhCS fodQvkmlGlUr2chkWj.LsmG7NgyvdseC01NE5jlFD1btoYIA2njIpYJfnXpa 8aROmgYaPVfz8Zykp1MFfrSZ38HhEmA8XV.lpowK_HcO7rPgdXNTqyDzHuOW l01r4DFZzjmF6IgrJsz8nTdU9R9xOm46TLPqxfeA95V2JyzOyeg-- X-Rocket-MIMEInfo: 002.001, SGkgYWxsLA0KDQpQbGVhc2Ugc2VlIHRoZSBiZWxvdyBjb2RlLGluIHdoaWNoIGknbSB2ZXJpZnlpbmcgdGhlIGdsb2JhbCB2YWx1ZSBpbiBweXRob24uDQoNCkNISz0xMA0KDQpkZWYgdGVzdDEoKToNCiAgICBwcmludCAiVmFsdWUgb2YgIENISyBpbiB0ZXN0MSIsQ0hLDQoNCmRlZiB0ZXN0MigpOg0KICAgIENISz00MA0KICAgIHByaW50ICJWYWx1ZSBvZiBDSEsgIGluIHRlc3QyIixDSEsNCiAgICB0ZXN0MSgpDQoNCmRlZiB0ZXN0MygpOg0KICAgIGdsb2JhbCBDSEsgDQogICAgdGVzdDIoKQ0KDQp0ZXN0MygBMAEBAQE- X-Mailer: YahooMailClassic/300 YahooMailWebService/0.8.155.576 Date: Mon, 26 Aug 2013 17:54:00 +0800 (SGT) From: chandan kumar Subject: Python Global variable To: python-list@python.org, Johannes Bauer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Mon, 26 Aug 2013 17:52:06 +0200 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1377532327 news.xs4all.nl 15987 [2001:888:2000:d::a6]:59930 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53006 Hi all, Please see the below code,in which i'm verifying the global value in python= . CHK=3D10 def test1(): print "Value of CHK in test1",CHK def test2(): CHK=3D40 print "Value of CHK in test2",CHK test1() def test3(): global CHK=20 test2() test3() When i ran above code ,I'm getting vlaue of CHK as 40 in test2 method and 1= 0 in test1 method Can somone explain me why the value of CHK is different in method test1 an= d test2. Best Regards, Chandan