[Python-Dev] redefining is
Barry Warsaw
barry at python.org
Fri Mar 19 18:04:19 EST 2004
On Fri, 2004-03-19 at 17:57, Phillip J. Eby wrote:
> At 05:40 PM 3/19/04 -0500, Andrew Koenig wrote:
>
> >Nevertheless, I still wish that expressions such as "x is 'foo'" did not
> >silently differ in outcome from one implementation to another.
>
> The part that drives me nuts about this discussion is that in my view, "x
> is 'foo'" has the *same* outcome on all implementations. That is, it's
> true if x refers to that exact string object.
>
> The thing that's different from one implementation to the next is whether
> there's any chance in hell of x being that same 'foo' string. But to me,
> that 'foo' string looks like a *newly created* string, so to the naive
> glance there's no possible way that it could be the same object. In other
> words, it looks like a bad expression to use in the first place: one that's
> guaranteed to be false, except by accident of implementation.
>
> So, I have trouble understanding how it is that somebody could get to a
> place where they think that using 'is' for strings and numbers is a good
> idea in the first place.
Thanks Phillip. My sentiments exactly.
-Barry
More information about the Python-Dev
mailing list