why cannot assign to function call

sturlamolden sturlamolden at yahoo.no
Tue Jan 6 18:45:02 CET 2009

On Jan 2, 11:39 am, Derek Martin <c... at pizzashack.org> 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.

For one thing, Python's 'assignment model' (an annoying buzzword) is
similar to that of Java. It cannot be that different from what is
thought in undergraduate CS classes.

But take a look at C++:

int& foobar(int& x) {
  // blahblah

Now a statement like 'foobar(x) = y;' can actually have a meaning.


int* foobar(int& x) {
  // blahblah

would make the same statement illegal. I have yet to see undergraduate
students knowing the difference between C++ pointers and references
after attending an introductory CS course.

Try to do the same in, say, Java. You will see that is behaves like

And as for bizarreness, I feel that Python and Java is greatly
surpassed by C++. Note that C do not share the bizarreness of C++.

More information about the Python-list mailing list