Puzzled by "is"

Neil Cerutti horpner at yahoo.com
Thu Aug 9 13:50:47 EDT 2007


On 2007-08-09, Dick Moores <rdm at rcblue.com> wrote:
> >>> () is ()
> True
> >>> (1,) is (1,)
> False
>
> Why?

>From _Python Reference Manual_: 5.2.4 List displays:

  An empty pair of parentheses yields an empty tuple object.
  Since tuples are immutable, the rules for literals apply (i.e.,
  two occurrences of the empty tuple may or may not yield the
  same object). 

-- 
Neil Cerutti



More information about the Python-list mailing list