This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jdharper
Recipients jdharper
Date 2011-02-18.19:05:19
SpamBayes Score 0.006816029
Marked as misclassified No
Message-id <1298055920.33.0.647090399072.issue11244@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2011-02-18 19:05:20jdharpersetrecipients: + jdharper
2011-02-18 19:05:20jdharpersetmessageid: <1298055920.33.0.647090399072.issue11244@psf.upfronthosting.co.za>
2011-02-18 19:05:19jdharperlinkissue11244 messages
2011-02-18 19:05:19jdharpercreate