[Python-Dev] redefining is

Guido van Rossum guido at python.org
Thu Mar 18 13:51:02 EST 2004


> Indeed.  Of course, object() is mutable, so there is no proposal to change
> the meaning of this program.  What I'm concerned about is someone trying to
> do the same thing this way:
> 
> 	missing = 'missing'
> 
> 	if d.get('somekey', missing) is 'missing':
> 		# it ain't there
> 
> This code contains a bug, but on an implementation that interns strings that
> happen to look like identifiers, no test will detect the bug.

I'm ready to pronounce.  The code is buggy.  There are good reasons to
keep 'is' the way it always was.  The definition of 'is' ain't gonna
change.  So be it.

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



More information about the Python-Dev mailing list