why cannot assign to function call

Derek Martin code at pizzashack.org
Mon Jan 5 06:27:31 CET 2009


Forgive my indulgence, I find this rather academic discussion kind of
interesting, as it turns out.

On Sun, Jan 04, 2009 at 10:55:09PM -0600, Derek Martin wrote:
> > You can't argue that one semantic or another is more intuitive
> > without offering evidence.
> 
> I think I have though, not that it matters, since that was never
> really my point.  Python's assignment model requires more explanation
> than the traditional one, simply to state what it does.  That alone is
> evidence (but not proof).  

Here's (I think) a better argument, FWIW:  The traditional model ties
a name to some (usually predefined and static) storage (a memory
address, or at least the start of a string of them).  This is a very
concrete thing to represent, and the conceptualization of variables as
named bins in such languages captures this very succinctly, and
requires no understanding of the underlying implementation for the
programmer to use (at least with primitive data types, which are all
that are used generally when variables are first introduced).

The Python model binds a name to a particular Python object, which is
itself an abstraction; understanding requires understanding first what
an "object" is, and I think at least in some measure some knowledge
about how Python is implemented (primitive data types are actually
objects; and also recall the recent discussion about what constitutes
a "value" in Python).  The abstraction, and the requirement to
partially understand the underlying implemenation, make the Python
model inherently more complicated, and therefore also inherently less
intuitive.

That also is not proof, but as I said, real proof is rather hard to
come by...  And FWIW, remember that I never suggested that all this
was without good reason, and I'm not attempting to advocate for
simplifying the model. :)

-- 
Derek D. Martin
http://www.pizzashack.org/
GPG Key ID: 0x81CFE75D

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20090104/78203695/attachment.pgp>


More information about the Python-list mailing list