On Feb 9, 2007, at 10:34 PM, Cecilia Alm wrote: > Why does the identity operator return "True" in the below cases, > that is when assigning the same value to basic variable types > (float, integer, string, bool..)? Are these rcopied by reference > (shallow)? If so why? > > >>> i = 10 > >>> j = 10 > >>> i is j > True
Here you're saying that "i" is equal to 10 and that "j" is equal to 10. Therefore "I' and "j" are the same > >>> a = 10 > >>> b = a > >>> a is b > True > What you're saying here is that "a" is equal to 10. Then you say that the variable "b" is equal to the variable "a". Therefore you're saying that b equals 10 and that "a" and "b" are equal. - Chris _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor