[Python-ideas] Make "is" checks on non-singleton literals errors

Chris Angelico rosuav at gmail.com
Tue Oct 9 00:02:32 CEST 2012

On Tue, Oct 9, 2012 at 6:44 AM, Mike Graham <mikegraham at gmail.com> wrote:
> There are no cases where
>     if x is "foo":
> is actually the code someone intended to write.

Are literals guaranteed to be interned? If so, this code would make
sense, if the programmer knows that x is itself an interned string.

Although I guess a warning wouldn't be a problem there, as they're
easily ignored/suppressed.


More information about the Python-ideas mailing list