1
>>> n('xxx')
0
+
+ >>> p(1)
+ 0
+ >>> p('a')
+ 1
+
+ >>> q(1)
+ Traceback (most recent call last):
+ TypeError: 'NoneType' object is not iterable
"""
def f(a,b):
def n(a):
cdef int result = a.lower() in [u'a *',u'b *',u'c *',u'd *']
return result
+
+def p(a):
+ cdef dict d = {u'a': 1, u'b': 2}
+ cdef int result = a in d
+ return result
+
+def q(a):
+ cdef dict d = None
+ cdef int result = a in d # should fail with a TypeError
+ return result
0
>>> n('xxx')
1
+
+ >>> p('a')
+ 0
+ >>> p(1)
+ 1
+
+ >>> q(1)
+ Traceback (most recent call last):
+ TypeError: 'NoneType' object is not iterable
"""
def f(a,b):
def n(a):
cdef int result = a.lower() not in [u'a *',u'b *',u'c *',u'd *']
return result
+
+def p(a):
+ cdef dict d = {u'a': 1, u'b': 2}
+ cdef int result = a not in d
+ return result
+
+def q(a):
+ cdef dict d = None
+ cdef int result = a not in d # should fail with a TypeError
+ return result