why cannot assign to function call

Dan Esch daniel.a.esch at gmail.com
Wed Jan 7 23:06:07 CET 2009


Okay, thanks...

Still trying to wrap my fragile little VBA-corrupted brain around names,
namespaces,  and objects.  Progress is being made.

For me, the naive idea of variable ==> label for bin has been hard to
get past simply because someone in the the back of my head is screaming,
"Wait, if the VARIABLE doesn't point to a memory address, (somewhere down
the implementation stack) whatinthehell does??"

Further reading clarifies:  For object X, id(X) is an immutable attribute
reference that can ultimately be bound to a memory address (he said,
blithely skipping over several layers of architecture...)  So, okay, now I
can relax.

To oversimplify (told you VBA warped my mind) everything in python is an
object (at some level).  At minimum, all objects have an identity-- id(X), a
type which subclasses and extends it from object, and some content, the
nature of which depends on the object type.

Once I got my head around the idea that there was something that was a fixed
point of reference for the object, nevermind what, then I could relax and
get on with get on with getting my head around names and namespaces.

Thanks for listening to me ramble.



On 1/7/09, Steve Holden <steve at holdenweb.com> wrote:
>
> Dan Esch wrote:
> > Wait a sec...
> >
> > I think I get this...
> >
> > In essence, the implication of immutability for Python is that there is
> > only one "parrot", one "spam,"in fact one anything. (This seems like it
> > must hold for data primitives - does it hold for complex objects as
> > well? It seems it must...) In addition there is only one 1, and one 2
> > etc.  We may or may not have realized that string in a memory address to
> > which variable names can be bound, but should we do so, there is only
> > one "parrot"
> >
> > Python, is in fact, a Platonic programming language.  Weird.  If I've
> > got this right, worth chewing on....
> >
> 'Fraid not. Certain immutables are cached by the interpreter, but most
> are not.
>
> >>> s1 = "a" + "b" + "c"
> >>> n = 12345
> >>> s2 = "ab" + chr(99)
> >>> m = 2469 * 5
> >>> s1 == s2
> True
> >>> s1 is s2
> False
> >>> n == m
> True
> >>> n is m
> False
> >>> id(s1), id(s2), id(n), id(m)
> (2146661888, 2146661792, 14453620, 14453584)
> >>>
>
> regards
> Steve
> --
> Steve Holden        +1 571 484 6266   +1 800 494 3119
> Holden Web LLC              http://www.holdenweb.com/
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090107/3f095aa4/attachment.html>


More information about the Python-list mailing list