Puzzled by "is"

Discussion in 'Python' started by Dick Moores, Aug 9, 2007.

  1. Dick Moores

    Dick Moores Guest

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

    False

    Why?

    Thanks,

    Dick Moores
     
    Dick Moores, Aug 9, 2007
    #1
    1. Advertising

  2. Dick Moores

    Neil Cerutti Guest

    On 2007-08-09, Dick Moores <> 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
     
    Neil Cerutti, Aug 9, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Andrew

    VHDL: puzzled beginner

    Mark Andrew, Jun 27, 2004, in forum: VHDL
    Replies:
    5
    Views:
    644
    Mark Andrew
    Jun 30, 2004
  2. Daniel

    still puzzled

    Daniel, Jun 8, 2004, in forum: ASP .Net
    Replies:
    11
    Views:
    649
    Steven Cheng[MSFT]
    Jun 9, 2004
  3. schiefaw

    Very Puzzled, Please Help

    schiefaw, Jul 22, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    377
    schiefaw
    Jul 22, 2005
  4. Replies:
    5
    Views:
    1,399
  5. EvelynAnd Ethan
    Replies:
    4
    Views:
    976
    =?Utf-8?B?Sko=?=
    Jan 9, 2006
Loading...

Share This Page