Python Interpreter Bug?

Chris Liechti cliechti at gmx.net
Fri Aug 23 19:36:19 EDT 2002


Rakis <rakis at gmpexpress.net> wrote in news:mailman.1030142381.27815.python-
list at python.org:
... 
>     if decl[i] is ":" and decl[i-1] is not ":" and decl[i+1] is not ":":

unlikely that this works as you want. note that "is" tests if they are the 
same objects (id(x) == id(y)). this can be true for '":" is ":"' because of 
string inlining, but its not required to be so, and it wont for most cases.

what you want is 'decl[i] == ":"' resp != which compares the content of the 
strings.

chris
-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list