Jeffrey Harper <jhar...@yapdc.com> added the comment: I have also determined that negative elements interfere with the frozenset optimization described in issue6690. http://bugs.python.org/issue6690.
Here's an example program: # test.py from dis import dis def x(var): return var in {1,2,3} # Note curly braces. These are sets. def y(var): return var in {1,-2,3} print ("dis x:") dis(x) print() print("dis y:") dis(y) Running this produces: C:\tmp>c:\Python32\python.exe test.py dis x: 3 0 LOAD_FAST 0 (var) 3 LOAD_CONST 4 (frozenset({1, 2, 3})) 6 COMPARE_OP 6 (in) 9 RETURN_VALUE dis y: 4 0 LOAD_FAST 0 (var) 3 LOAD_CONST 1 (1) 6 LOAD_CONST 4 (-2) 9 LOAD_CONST 3 (3) 12 BUILD_SET 3 15 COMPARE_OP 6 (in) 18 RETURN_VALUE ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11244> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com