Puzzled by "is"
rdm at rcblue.com
Sun Aug 12 18:34:42 CEST 2007
At 08:23 AM 8/12/2007, Steve Holden wrote:
>Dick Moores wrote:
> > So would a programmer EVER use "is" in a script?
>Sure. For example, the canonical test for None uses
> x is None
>because there is only ever one instance of type Nonetype, so it's the
>fastest test. Generally speaking you use "is" to test for identity (do
>these two expressions reference the same object) rather than equality
>(do these two expressions evaluate to equivalent objects).
Off the top of your head, could you or others give me as many
examples as you can think of?
More information about the Python-list