Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.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: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; 'assign': 0.07; 'variables': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:into': 0.09; 'variable,': 0.09; 'variables.': 0.09; 'python': 0.11; 'program),': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:variable': 0.16; 'wrote:': 0.18; 'variable': 0.18; "python's": 0.19; 'appears': 0.22; 'header:User-Agent:1': 0.23; 'received:comcast.net': 0.24; 'pass': 0.26; 'values': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'am,': 0.29; 'values.': 0.31; 'writes:': 0.31; 'something': 0.35; 'really': 0.36; 'subject:?': 0.36; 'to:addr :python-list': 0.38; 'fact': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'subject:Can': 0.60; 'details.': 0.61; 'course': 0.61; 'more': 0.64; 'different': 0.65; 'sam': 0.68; 'fact,': 0.69; 'hate': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ned Batchelder Subject: Re: Can global variable be passed into Python function? Date: Fri, 21 Feb 2014 07:13:25 -0500 References: <27ac2248-0ca3-4ba6-9d25-eaad324bc5e9@googlegroups.com> <87sird7wuw.fsf@handshake.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: c-50-133-228-126.hsd1.ma.comcast.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: <87sird7wuw.fsf@handshake.de> 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392984818 news.xs4all.nl 2878 [2001:888:2000:d::a6]:60603 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66829 On 2/21/14 2:23 AM, dieter wrote: > Sam writes: > >> >I need to pass a global variable into a python function. > Python does not really have the concept "variable". > > What appears to be a variable is in fact only the binding of an > object to a name. If you assign something to a variable, > all you do is binding a different object to the name. > Man, do I hate this idea that Python has no variables. It has variables (names associated with values, and the values can change over the course of the program), they just don't work the same as C or Fortran variables. In fact, they work exactly the same as Javascript or Ruby variables. Python's variables are names bound to values. http://nedbatchelder.com/text/names.html has lots more details. -- Ned Batchelder, http://nedbatchelder.com