On 06/15/2013 07:07 AM, Nick the Gr33k wrote: > result = mylist (since its a no-emoty list) > >>>>> result.append('bar') >>>>> result is mylist >> True > > Never seen the last statement before. What does that mean? > result is mylist ????
Yes. Surprisingling good question. http://docs.python.org/3.3/reference/expressions.html#is http://docs.python.org/3/reference/datamodel.html One thing that you may find interesting is that what we often call variables in Python, and which from your code's point of view look and act like variables are in fact names. Whereas in C, assignment can be thought of as copy (a = b in C means that b's value is copied to a), in Python assignment is associating a name with an object. Thus a = b in Python means that now the names a and b both are bound (reference to) the same object. That's why the "is" operator is there, to help one know if two names point to the same object. I bring this up on the list from time to time because I find it really interesting and intellectually appealing the way Python works. Hearkens back to my class at uni on programming language theory. -- http://mail.python.org/mailman/listinfo/python-list