Closures in leu of pointers?

Ian Kelly ian.g.kelly at gmail.com
Sun Jun 30 13:18:41 EDT 2013


On Sun, Jun 30, 2013 at 11:13 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> On Sun, Jun 30, 2013 at 4:07 AM, Antoon Pardon
> <antoon.pardon at rece.vub.ac.be> wrote:
>> I don't think this reference is as strong as you think it is. Here is
>> a paragraph somewhat lower:
>>
>> ] If a name is bound in a block, it is a local variable of that block,
>> ] unless declared as nonlocal. If a name is bound at the module level, ] it
>> is a global variable. (The variables of the module code block are ] local
>> and global.) If a variable is used in a code block but not
>> ] defined there, it is a free variable.
>>
>> So the language documentation mentions these names as being variables.
>
> It seems to refer to "local" and "global" variables as a short hand
> for talking about specific types of name binding, which is the
> dominant nomenclature of the documentation.  You asked why people talk
> about Python binding names instead of assigning variables, and I think
> the reference material is a clear source for that, even if it does
> also use the word "variable".  There is also the section on assignment
> statements, where it again refers to names being bound, not variables
> being assigned:
>
> http://docs.python.org/3/reference/simple_stmts.html#assignment-statements

Actually, looking back at your earlier post, I think I misunderstood
your question.  You weren't asking "why do people talk about binding
names instead of assigning variables in Python", but more strongly
"why do people claim there are no variables in Python"?  If the latter
is a common claim, then I haven't really taken notice of it, but I'll
take your word that you have.  I don't agree with that -- saying that
Python has no variables is just an argument of semantics.



More information about the Python-list mailing list