The “does Python have variables?” debate

Mark H Harris harrismh777 at gmail.com
Wed May 7 15:31:13 EDT 2014


On 5/7/14 10:48 AM, Jerry Hill wrote:
> I think it's rather silly for someone to insist that python doesn't have
> variables.  On the other hand, I think it can be useful to point out
> that python variable aren't like C variables, and that thinking of
> python variables as having two parts -- names and values -- really can
> help people who are struggling to learn the language.  I know it
> certainly helped me.
>

But here is the rub:  BASIC also has -- names and values --;  although 
they are in a variable table, and they refer to memory not objects.

C is the same, basically.  ehem.  ... a name bound to an address that 
references a chunk of memory (by type) of a certain length.

... and we could go on.

But, Python's names bound to objects not only doesn't behave like the 
'variables' mentioned above, they provide for serious side-effects for 
the programmer if the coder does not think of them properly as names 
bound to objects. And that means surprises.

So, when anyone points out that Python does not have variables, but 
rather Python has names bound to objects... they are being most helpful.

As I pointed out earlier, I think the better approach would be to find 
positive language for helping new folks understand Python's beautiful 
heart, than the relatively negative language of stating Python has no 
variables.






More information about the Python-list mailing list