Path: csiph.com!usenet.pasdenom.info!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'languages.': 0.04; 'subject:Python': 0.06; '21,': 0.07; 'assignment': 0.07; 'differently': 0.07; 'javascript,': 0.07; 'perl,': 0.07; 'variables': 0.07; 'php,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'ruby,': 0.09; 'subject:into': 0.09; 'variables.': 0.09; 'python': 0.11; 'changes': 0.15; '+11': 0.16; 'dictionary,': 0.16; 'example)': 0.16; 'lisp,': 0.16; 'merely': 0.16; 'mutable': 0.16; 'program),': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:variable': 0.16; 'travis': 0.16; 'wrote:': 0.18; "python's": 0.19; 'value.': 0.19; 'feb': 0.22; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'received:comcast.net': 0.24; 'holds': 0.26; 'references': 0.26; 'values': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'idea': 0.28; 'fixed': 0.29; 'am,': 0.29; 'object.': 0.31; 'fri,': 0.33; 'object,': 0.36; 'subject:?': 0.36; 'list': 0.37; 'thank': 0.38; 'tired': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'subject:Can': 0.60; 'course': 0.61; 'address': 0.63; 'name': 0.63; 'world': 0.66; 'fact,': 0.69; '2014,': 0.84; 'batchelder': 0.84; 'metaphor.': 0.84; '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 22:14:14 -0500 References: <27ac2248-0ca3-4ba6-9d25-eaad324bc5e9@googlegroups.com> <87sird7wuw.fsf@handshake.de> <8454E8CB-E6E3-452F-8E54-9A77BFF34EC2@gmail.com> <1m3gg9lbf2ln5m2kbki954t17mqni3b20k@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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: <1m3gg9lbf2ln5m2kbki954t17mqni3b20k@4ax.com> 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: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393038871 news.xs4all.nl 2855 [2001:888:2000:d::a6]:46859 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66868 On 2/21/14 9:47 PM, Dennis Lee Bieber wrote: > On Fri, 21 Feb 2014 09:59:17 -0800, Travis Griggs > declaimed the following: > >> On Feb 21, 2014, at 4:13 AM, Ned Batchelder wrote: >> >>> 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. >> >> Thank you! >> >> +11 >> >> I get tired of the “Python doesn’t have variables” line. >> > > If one is coming from the world where "variable" means "name > identifying a fixed location in memory" then Python does not have > "variables". > > BASIC, C, FORTRAN, COBOL, Assembly... A "variable" is synonym for an > address [a box that holds things]. > > Even Python's mutable types (list, dictionary, for example) do not > follow the "fixed location" metaphor. Each cell in a list merely references > some object, and assignment to that cell changes the reference, not the > object. > So we agree: variables in Python work differently than they do in those languages. If one is coming from the world where "variable" means "name bound to a value", then Python does have "variables". Javascript, Ruby, Lisp, Perl, PHP, Smalltalk, Lua, Julia... a "variable" is a name bound to a value. -- Ned Batchelder, http://nedbatchelder.com