[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can global variable be passed into Python function?

On Sat, Feb 22, 2014 at 7:35 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> 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.)