On Oct 17, 10:03 pm, Joe Strout <[EMAIL PROTECTED]> wrote:
> On Oct 17, 2008, at 2:36 PM, Steve Holden wrote:
>
[big snip]
> > I believe they are pretty much the same ass those of Icon, another
> > non-standard interpreted language.
>
> They're also the same as RB, Java, .NET... I'm hoping somebody who  
> knows some other modern OOP language (e.g. Ruby) will weigh in,  
> because I bet it's the same as those too.
>
[snip]
The difference is that Python uses dictionaries. When you write:

    x = 42

what actually happens is something like:

    globals()["x"] = 42

or:

    locals()["x"] = 42

The name of the "variable" is a key in a dictionary with the value (a
reference to an object) that was "assigned" being the associated
value. When you "del" a "variable", eg del x, you're removing the
entry from the dictionary.

In Java the variables are like members in a struct (or fields in a
record in Pascal parlance) with the value that was assigned being its
content. (In Java there's also the detail that primitive types like
int are stored directly and not as references for reasons of speed.)
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to