"kirby urner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
I've suggesting seeing 8 as a name only briefly, temporary gestalt
switch, then go back to seeing it as a literal, kind of like a name
in that you can do dot notation on it, i.e. there's an underlying
object that's responsive to these triggers (like 8 .__add__(5)
instead of just 8 + 5).  But is the underlying object "anonymous"?

It has a memory location:

id(8)
12015636

id('8')
13259744

And I'm able to refer to it.  I didn't make up a name for it, like
eight, because I didn't need to, it's already permanently
accessible through 8.


Numbers are just language syntax to create objects. If they aren't assigned a name, they disappear.

x=1000
y=x
z=x
y is z
True

x is the name of an object.  y and z also are names for that object.
1000 is not a name:

x=1000
y=1000
z=1000
x is y
False
x is z
False
y is z
False

a new object is created each time.

-Mark

P.S. Note, at least in CPython, that same example won't work for small numbers because of an implementation detail that caches the common 'small number' objects for performance reasons.

x=1
y=1
z=1
x is y
True
y is z
True


_______________________________________________
Edu-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/edu-sig

Reply via email to