472,094 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,094 software developers and data experts.

Puzzled by "is"

>>() is ()
True
>>(1,) is (1,)
False

Why?

Thanks,

Dick Moores

Aug 9 '07 #1
1 976
On 2007-08-09, Dick Moores <rd*@rcblue.comwrote:
>() 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
Aug 9 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Ajax Chelsea | last post: by
235 posts views Thread by napi | last post: by
24 posts views Thread by hjbortol | last post: by
60 posts views Thread by K. G. Suarez | last post: by
15 posts views Thread by Bobby C. Jones | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.