Difference between 'is' and '=='

Joel Hedlund joel.hedlund at gmail.com
Tue Mar 28 04:31:23 EST 2006


> This does *not* also mean constants and such:
<snip>
>     >>> a = 123456789
>     >>> a == 123456789
>     True
>     >>> a is 123456789
>     False
>     >>> 

I didn't mean that kind of constant. I meant named constants with defined 
meaning, as in the example that I cooked up in my post. More examples: os.R_OK, 
or more complex ones like mymodule.DEFAULT_CONNECTION_CLASS.

Sorry for causing unneccessary confusion.

Cheers!
/Joel Hedlund



More information about the Python-list mailing list