why cannot assign to function call

Derek Martin code at pizzashack.org
Fri Jan 2 21:44:44 CET 2009

On Fri, Jan 02, 2009 at 11:43:30AM -0500, Steve Holden wrote:
> Derek Martin wrote:
> > What the Python community often overlooks, when this discussion again
> > rears its ugly head (as it seems to every other hour or so), is that
> > its assignment model is BIZARRE, as in it's conceptually different
> > from virtually all other languages substantially taught in
> > undergraduate computer science programs.  And for that matter, it's
> > pretty unintuitive generally.
> > 
> I'd definitely argue against bizarre. It's actually very easy to
> understand, and Python is by no means the only language to have used it.

Clearly the first and third are true. :)  But CS programs still
generally teach primarily C/C++, Java, and (some form of) assembly
AFAICT.  A few odd ones pop up here and there along the way (I studied
with scheme, for example), but they vary and are highly
program-dependent.  What the average CS grad sees is, AFAICT, still
very much what I described.  Those languages also behave similarly to
what students see in mathematics (e.g. algebra etc.).  With only that
to go on, Python seems rather weird, and I think from the frequency
with which these discussions occur on this list, clearly it *IS*
difficult for a neophyte Python programmer to understand the
assignment model.  And this is, in part, because it's kind of
difficult to explain precisely, as has oft been demonstrated in this

> I'd argue that this approach is out of date and overly-restrictive,

Sure, I already hinted that it's useful... but it's still uncommon, in
the experience of most CS students -- not even taking into account the
number of people who program who have never studied in a formal CS

> I'd instead say that Python uses ephemeral names for long-lived objects,
> where other languages use the addresses of ephemeral objects. Your ideas
> of "simple" and "sensible" are being conditioned by your experience.

Of course...  I'd argue that our experience is a large part of what
makes things simple or sensible.  Things that behave like other things
we are very familiar will be simple to understand.  Python's
assignment model is probably new to most people when they first start
using it.  To look at Python's code, at first glance assignment seems
to be the same as everywhere else you've encountered it...  Only once
someone starts to write "real" programs does the difference really

> > It's small wonder that neophytes try to cram Python behaviors into
> > terms and computing concepts they already understand from learning
> > other languages, and that they fail to do so.  What's mystifying is
> > that when Pythonistas reply to their messages, they universally seem
> > confused at how this could possibly happen, and often enough actually
> > seem offended (or at least offensive) when it inevitably does happen...
> > 
> Generally speaking we try not to be offensive first on this list.

Perhaps I've misused the term Pythonista... I meant roughly, "people
who frequent this list/news group who seem to consider themselves 
experts at programming Python (and for the most part, are)."
I consider myself pretty well informed about Python (though not an
expert by any means), and I still read this list often (I use the
mailing list interface), because I still find that I learn useful
things from the posts to it from time to time.  But I often see python
"experts" lambasting people who clearly from their posts are new at
python, because their code is bad, their understanding is bad, or in
this case even accusing the learning materials of being sub-par.  I
realize that some of this is meant in jest, but a lot of it isn't, and
it can be quite difficult for someone who doesn't speak your language
natively (or even one who does, given the medium) to tell the
difference.  There are better ways to foster understanding... ;-)

Derek D. Martin
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/20090102/d160043e/attachment.pgp>

More information about the Python-list mailing list