Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'syntax': 0.04; 'subject:Python': 0.06; '22,': 0.09; 'if,': 0.09; 'pointers': 0.09; 'subject:into': 0.09; 'cc:addr:python-list': 0.11; '(last': 0.16; '7:35': 0.16; 'clarified': 0.16; 'exist.': 0.16; 'fluent': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:variable': 0.16; 'sat,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'instance,': 0.24; 'pointer': 0.24; 'cc:2**0': 0.24; '(see': 0.26; 'equivalent': 0.26; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; "d'aprano": 0.31; 'pascal': 0.31; 'steven': 0.31; 'yes.': 0.31; 'probably': 0.32; 'received:google.com': 0.35; 'subject:?': 0.36; 'similar': 0.36; 'should': 0.36; 'pm,': 0.38; 'anything': 0.39; 'does': 0.39; 'address.': 0.39; 'how': 0.40; 'subject:Can': 0.60; 'ago,': 0.61; 'strictly': 0.61; 'address': 0.63; 'talking': 0.65; 'said:': 0.68; 'consequences': 0.74; 'address,': 0.75; 'to:none': 0.92 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:cc :content-type; bh=Y71lUM4WbU28zrajvyT7OEUCgI+TC5xJOaKNlVymQqg=; b=tPxzWOYAhYP9cUqjTKMC5tZRJBdAqPbvjtidrphe+SGDnC9WUw5aGUpY6Q8lIuOb2z 5kx44NlwgRDc/XdBPCHJPq3M09ix6Qhuh6AKOvyclx/ePWapXwKM5v9VBZqjoYiBaNk+ 4vz0LIgJKtiIg6+R+1lrJYmWj0lhVMJLnWJ421ntuesYFb0LUYNo2S8JU1pjMBb3egTU c2HiWguqDBePraKfiq2dpW9kKk7KGnEW0QipKJxdb6yn2hdFUpee4PUzyOdMzMPDYnLs MQHgfq8xNIvFzk1EpFh80ocg8FjP7P7BZTSFT2+1hmszJhZPUXhkdUFESGEf5PdSZwgY yXOw== MIME-Version: 1.0 X-Received: by 10.68.200.74 with SMTP id jq10mr13801226pbc.169.1393058734370; Sat, 22 Feb 2014 00:45:34 -0800 (PST) In-Reply-To: <5308614c$0$29985$c3e8da3$5496439d@news.astraweb.com> References: <27ac2248-0ca3-4ba6-9d25-eaad324bc5e9@googlegroups.com> <87sird7wuw.fsf@handshake.de> <8454E8CB-E6E3-452F-8E54-9A77BFF34EC2@gmail.com> <87bny0w9w3.fsf@elektro.pacujo.net> <53084f42$0$29985$c3e8da3$5496439d@news.astraweb.com> <5308614c$0$29985$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 22 Feb 2014 19:45:34 +1100 Subject: Re: Can global variable be passed into Python function? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393058737 news.xs4all.nl 2902 [2001:888:2000:d::a6]:41677 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66887 On Sat, Feb 22, 2014 at 7:35 PM, Steven D'Aprano wrote: >> Yep. I should have clarified that I wasn't talking about Pascal; I'm not >> fluent in the language (last time I did anything at all with Pascal was >> probably about ten years ago, and not much then). In C, it strictly does >> what I said: & takes the address of something, * dereferences an >> address. There's no way to "pass a variable" - you have to pass the >> address, and that has consequences if, for instance, you *return* an >> address and the variable ceases to exist. (Does Pascal have an >> equivalent of that?) > > Yes, Pascal has pointers as a first-class data type. Syntax is similar to > C, ^x is a pointer to x, p^ dereferences the pointer p. > Right, I remember those now. Yes. (See how rusty I am on it? Heh.) ChrisA