Explanation of list reference
Chris Angelico
rosuav at gmail.com
Fri Feb 14 19:57:33 EST 2014
More information about the Python-list mailing list
Fri Feb 14 19:57:33 EST 2014
- Previous message (by thread): Explanation of list reference
- Next message (by thread): Explanation of list reference
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, Feb 15, 2014 at 8:43 AM, Marko Rauhamaa <marko at pacujo.net> wrote: > Unfortunately neither the "everything is a reference" model nor the > "small/big" model help you predict the value of an "is" operator in the > ambiguous cases. Can you give an example of an ambiguous case? Fundamentally, the 'is' operator tells you whether its two operands are exactly the same object, nothing more and nothing less, so I assume your "ambiguous cases" are ones where it's possible for two things to be either the same object or two indistinguishable ones. The only situation I can think of is that immutables are allowed to be interned, which is why this comes up True (in CPython) when it would come up False with larger values (as I demonstrated earlier): >>> x = 1 >>> y = 2 >>> z = x + y >>> z is 3 True ChrisA
- Previous message (by thread): Explanation of list reference
- Next message (by thread): Explanation of list reference
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list