2016-11-30 | Paul Boddie | raw annotate files changeset graph | Store defaults in bound method structures, not unbound method structures. |
1 def f(d): 2 return d.keys() 3 4 #def g(d): 5 # for key, value in d.items(): 6 # return value 7 8 d = {10 : "a", 20 : "b"} 9 l = f(d) 10 print 10 in l # True 11 print 20 in l # True 12 print 30 in l # False 13 14 l = d.values() 15 print "a" in l # True 16 print "b" in l # True 17 print "c" in l # False 18 19 20 #v = g(d) # either "a" or "b" 21 #print v == "a" or v == "b" # True