Google Groups Home
Help | Sign in
The 'is' identity operator checking immutable values caution
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
wxpytho...@gmail.com  
View profile
(1 user)  More options May 13, 6:10 am
Newsgroups: comp.lang.python
From: wxPytho...@gmail.com
Date: Tue, 13 May 2008 03:10:13 -0700 (PDT)
Local: Tues, May 13 2008 6:10 am
Subject: The 'is' identity operator checking immutable values caution
We have to avoid the use of the 'is' identity operator with basic,
immutable values such as numbers and strings. The result is
unpredictable because of the way Python handles these objects
internally.

How is with this issue in Python 3.0? Is it fixed? Does Python handle
this things properly now?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
castiro...@gmail.com  
View profile
(1 user)  More options May 13, 6:26 am
Newsgroups: comp.lang.python
From: castiro...@gmail.com
Date: Tue, 13 May 2008 03:26:11 -0700 (PDT)
Local: Tues, May 13 2008 6:26 am
Subject: Re: The 'is' identity operator checking immutable values caution
On May 13, 5:10 am, wxPytho...@gmail.com wrote:

> We have to avoid the use of the 'is' identity operator with basic,
> immutable values such as numbers and strings. The result is
> unpredictable because of the way Python handles these objects
> internally.

> How is with this issue in Python 3.0? Is it fixed? Does Python handle
> this things properly now?

Ooo.  Timing.  Good one.  <joins rip on 3.0>

Writer's other wanderings bring Microsoft Research.  Who talks to that
on a daily basis?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marco Mariani  
View profile
 More options May 13, 6:26 am
Newsgroups: comp.lang.python
From: Marco Mariani <ma...@sferacarta.com>
Date: Tue, 13 May 2008 12:26:13 +0200
Local: Tues, May 13 2008 6:26 am
Subject: Re: The 'is' identity operator checking immutable values caution

wxPytho...@gmail.com wrote:
> We have to avoid the use of the 'is' identity operator with basic,
> immutable values such as numbers and strings.

I'm glad for you. Did you really write checks like "if foo is 27" ?

The point is, you have to learn technologies to use them. It's not like
technologies learn you (not even in soviet Russia)

> How is with this issue in Python 3.0? Is it fixed?

There is nothing to fix.

> Does Python handle this things properly now?

It always did.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Heimes  
View profile
 More options May 13, 6:37 am
Newsgroups: comp.lang.python
From: Christian Heimes <li...@cheimes.de>
Date: Tue, 13 May 2008 12:37:38 +0200
Local: Tues, May 13 2008 6:37 am
Subject: Re: The 'is' identity operator checking immutable values caution
wxPytho...@gmail.com schrieb:

> We have to avoid the use of the 'is' identity operator with basic,
> immutable values such as numbers and strings. The result is
> unpredictable because of the way Python handles these objects
> internally.

You are confusing immutable objects with singletons. Never use "is" with
strings and numbers.

Christian


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
castiro...@gmail.com  
View profile
(1 user)  More options May 13, 6:59 am
Newsgroups: comp.lang.python
From: castiro...@gmail.com
Date: Tue, 13 May 2008 03:59:56 -0700 (PDT)
Local: Tues, May 13 2008 6:59 am
Subject: Re: The 'is' identity operator checking immutable values caution
On May 13, 5:37 am, Christian Heimes <li...@cheimes.de> wrote:

> wxPytho...@gmail.com schrieb:

> > We have to avoid the use of the 'is' identity operator with basic,
> > immutable values such as numbers and strings. The result is
> > unpredictable because of the way Python handles these objects
> > internally.

> You are confusing immutable objects with singletons. Never use "is" with
> strings and numbers.

> Christian

I was back on 'handle'.  Handle internally, handle right.  Gotta be 6
a.m.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruno Desthuilliers  
View profile
 More options May 13, 11:59 am
Newsgroups: comp.lang.python
From: Bruno Desthuilliers <bruno.42.desthuilli...@websiteburo.invalid>
Date: Tue, 13 May 2008 17:59:01 +0200
Local: Tues, May 13 2008 11:59 am
Subject: Re: The 'is' identity operator checking immutable values caution
wxPytho...@gmail.com a écrit :

> We have to avoid the use of the 'is' identity operator with basic,
> immutable values such as numbers and strings. The result is
> unpredictable because of the way Python handles these objects
> internally.

> How is with this issue in Python 3.0? Is it fixed? Does Python handle
> this things properly now?

This is not an issue and is already properly handled. Don't use identity
test when you want an equality test, period.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google