Bryan Murdock wrote:
> I'm not a compiler guy, but I know dynamic languages like Python don't
> need to differentiate between those two cases.  Is it an aspect of
> compiled languages that require the distinction?

That's because what you are calling a python "variable" isn't a variable
in the same sense as a statically-typed, compiled language.  In Python a
"variable" is really just a name that's bound to an object.  It is
interesting to note that this does not create a variable:

a = 5

Rather it binds the name "a" to an immutable object, 5.  In other words
you cannot change the object that a points to.  Doing math is an
exercise in rebinding the name:

a = a + 4

Even better, if you did this, you have 2 names bound to the _same_ object:

a = 5
b = a

assert(a is b)



--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list

Reply via email to