Difference between 'is' and '=='
Joel Hedlund
joel.hedlund at gmail.com
Wed Mar 29 02:44:44 EST 2006
> If it weren't for the current CPython optimization (caching small
> integers)
This has already been covered elsewhere in this thread. Read up on it.
> this code which it appears you would support writing
>
> if (flags & os.R_OK) is os.R_OK:
I do not.
You compare a module.CONSTANT to the result of an expression (flags & os.R_OK).
Expressions are not names bound to objects, the identity of which is what I'm
talking about. This example does not apply. Also, the identity check in my
example has a value equality fallback. Yours doesn't, so it really does not apply.
> (I think you should give it up... you're trying to push a rope.)
I'm not pushing anything. I just don't like being misquoted.
Cheers,
Joel Hedlund
More information about the Python-list
mailing list