[Python-Dev] redefining is

Guido van Rossum guido at python.org
Wed Mar 24 08:55:49 EST 2004


> If the objects' value is (3, 4), you can use ==.
> 
> If the objects' value is (3, a), there's no really easy way to do it.
> 
> If the objects' value is [3, 4], you can use 'is'.
> 
> I think it would be useful to have an operation that is as easy to
> use as 'is' that would make the determination.

You've said that a few times.  While the concept is clear and easily
implemented: by adding a special method that defaults to 'is' but is
done differently for tuples, numbers and strings.  But I'm not sure
what having this check available would buy me.  Can you show some
application that would actually use this in a way that can't be easily
done without a language addition?

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list