21

Given the following code:

d = {'a':1, 'b':2}

if not 'c' in d:
 print 'kaboom'

if 'c' not in 'd':
 print 'kaboom'

In both cases this prints 'kaboom'. What is the difference and why PEP8 complains about the former.

Eugen
  • 2,292
  • 3
  • 29
  • 43

0 Answers0