I have the following code:
#!/usr/bin/python3
import configparser
config = configparser.ConfigParser()
config.read('bindslash.ini')
print([name for name in config.sections() if name is not 'bindslash'])
bindslash.ini
looks like this:
[bindslash]
[somethingelse]
Running this program produces ['bindslash', 'somethingelse']
. However, if I change the is not
in the list comprehension to be !=
instead, the program correctly produces ['somethingelse']
. As far as I understand it, these should be the exact same thing. Why isn't is not
working?
I'm on Python 3.5.0, installed from Homebrew on OS X.