code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
print slice(1,2,3)
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(slice(1,2,3))"
] |
class Stuff(object):
def __cmp__(self, rhs):
print "stuff cmp"
return 0
class Things(object):
def __cmp__(self, rhs):
print "things cmp"
return 0
class Other(object): pass
Stuff() < Things()
Stuff() <= Things()
Stuff() > Things()
Stuff() >= Things()
Stuff() == Things()
Stuff() != Things()
Things() < Stuff()
Things() <= Stuff()
Things() > Stuff()
Things() >= Stuff()
Things() == Stuff()
Things() != Stuff()
Stuff() < Other()
Stuff() <= Other()
Stuff() > Other()
Stuff() >= Other()
Stuff() == Other()
Stuff() != Other()
Other() < Stuff()
Other() <= Stuff()
Other() > Stuff()
Other() >= Stuff()
Other() == Stuff()
Other() != Stuff()
| [
[
3,
0,
0.0641,
0.1026,
0,
0.66,
0,
710,
0,
1,
0,
0,
186,
0,
1
],
[
2,
1,
0.0769,
0.0769,
1,
0.27,
0,
271,
0,
2,
1,
0,
0,
0,
1
],
[
8,
2,
0.0769,
0.0256,
2,
0.83,
... | [
"class Stuff(object):\n def __cmp__(self, rhs):\n print(\"stuff cmp\")\n return 0",
" def __cmp__(self, rhs):\n print(\"stuff cmp\")\n return 0",
" print(\"stuff cmp\")",
" return 0",
"class Things(object):\n def __cmp__(self, rhs):\n print(\"things ... |
print 2**3
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(2**3)"
] |
def yrange(n):
for i in range(n):
yield i
print list(yrange(5))
| [
[
2,
0,
0.5,
0.75,
0,
0.66,
0,
187,
0,
1,
0,
0,
0,
0,
1
],
[
6,
1,
0.625,
0.5,
1,
0.27,
0,
826,
3,
0,
0,
0,
0,
0,
1
],
[
8,
2,
0.75,
0.25,
2,
0.12,
0,
0,
... | [
"def yrange(n):\n for i in range(n):\n yield i",
" for i in range(n):\n yield i",
" yield i",
"print(list(yrange(5)))"
] |
print 2^7
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(2^7)"
] |
class X: pass
print repr(X())
print str(X())
| [
[
3,
0,
0.3333,
0.3333,
0,
0.66,
0,
783,
0,
0,
0,
0,
0,
0,
0
],
[
8,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
535,
3,
1,
0,
0,
0,
0,
3
],
[
8,
0,
1,
0.3333,
0,
0.66,
1,... | [
"class X: pass",
"print(repr(X()))",
"print(str(X()))"
] |
print ord(chr(128))
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
]
] | [
"print(ord(chr(128)))"
] |
class O(object): pass
class F(O): pass
class E(O): pass
class D(O): pass
class C(D,F): pass
class B(E,D): pass
class A(B,C): pass
print A.__mro__
| [
[
3,
0,
0.125,
0.125,
0,
0.66,
0,
720,
0,
0,
0,
0,
186,
0,
0
],
[
3,
0,
0.25,
0.125,
0,
0.66,
0.1429,
498,
0,
0,
0,
0,
720,
0,
0
],
[
3,
0,
0.375,
0.125,
0,
0.66,
... | [
"class O(object): pass",
"class F(O): pass",
"class E(O): pass",
"class D(O): pass",
"class C(D,F): pass",
"class B(E,D): pass",
"class A(B,C): pass",
"print(A.__mro__)"
] |
print int(3)
print int(3.2)
print int(3.8)
print int(-3.2)
print int(-3.8)
print int(013)
print int(0x13)
print "------"
print int("3")
print int("013")
print "------"
print int("13", 8)
print int("013", 8)
print "------"
print int("13", 0)
print int("013", 0)
print int("0x13", 0)
print "------"
print int("13", 16)
print int("013", 16)
| [
[
8,
0,
0.0526,
0.0526,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.1053,
0.0526,
0,
0.66,
0.0556,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.1579,
0.0526,
0,
0.66... | [
"print(int(3))",
"print(int(3.2))",
"print(int(3.8))",
"print(int(-3.2))",
"print(int(-3.8))",
"print(int(0x13))",
"print(\"------\")",
"print(int(\"3\"))",
"print(int(\"013\"))",
"print(\"------\")",
"print(int(\"13\", 8))",
"print(int(\"013\", 8))",
"print(\"------\")",
"print(int(\"13\"... |
x = ["hello"]
y = list(x)
x[0] = "hi"
print y[0]
| [
[
14,
0,
0.25,
0.25,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.5,
0.25,
0,
0.66,
0.3333,
304,
3,
1,
0,
0,
430,
10,
1
],
[
14,
0,
0.75,
0.25,
0,
0.66,
0... | [
"x = [\"hello\"]",
"y = list(x)",
"x[0] = \"hi\"",
"print(y[0])"
] |
print ord('X')
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(ord('X'))"
] |
print object.__bases__
print object.__mro__
class X(object): pass
class Y(X): pass
print(X.__bases__)
print(X.__mro__)
print(Y.__bases__)
print(Y.__mro__)
| [
[
8,
0,
0.125,
0.125,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.25,
0.125,
0,
0.66,
0.1429,
535,
3,
1,
0,
0,
0,
0,
1
],
[
3,
0,
0.375,
0.125,
0,
0.66,
0... | [
"print(object.__bases__)",
"print(object.__mro__)",
"class X(object): pass",
"class Y(X): pass",
"print(X.__bases__)",
"print(X.__mro__)",
"print(Y.__bases__)",
"print(Y.__mro__)"
] |
print [x for x in range(1,10) if False] or ["hello" for x in range(1,10) if True]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
]
] | [
"print([x for x in range(1,10) if False] or [\"hello\" for x in range(1,10) if True])"
] |
x="OK";print x
| [] | [] |
def test(x,y):
return x+y
r = test(3,5)
print r
| [
[
2,
0,
0.375,
0.5,
0,
0.66,
0,
224,
0,
2,
1,
0,
0,
0,
0
],
[
13,
1,
0.5,
0.25,
1,
0.43,
0,
0,
4,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.75,
0.25,
0,
0.66,
0.5,
436... | [
"def test(x,y):\n return x+y",
" return x+y",
"r = test(3,5)",
"print(r)"
] |
def default_outside(x=[]):
return x
a = default_outside()
a.append(1)
print a
b = default_outside()
b.append(2)
print b
| [
[
2,
0,
0.1667,
0.2222,
0,
0.66,
0,
862,
0,
1,
1,
0,
0,
0,
0
],
[
13,
1,
0.2222,
0.1111,
1,
0.66,
0,
0,
2,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.4444,
0.1111,
0,
0.66,
... | [
"def default_outside(x=[]):\n return x",
" return x",
"a = default_outside()",
"a.append(1)",
"print(a)",
"b = default_outside()",
"b.append(2)",
"print(b)"
] |
def func():
return "dog"
def wee():
assert 1 != 2
assert "dog" == func()
wee()
| [
[
2,
0,
0.2143,
0.2857,
0,
0.66,
0,
856,
0,
0,
1,
0,
0,
0,
0
],
[
13,
1,
0.2857,
0.1429,
1,
0.92,
0,
0,
1,
0,
0,
0,
0,
3,
0
],
[
2,
0,
0.5714,
0.4286,
0,
0.66,
... | [
"def func():\n return \"dog\"",
" return \"dog\"",
"def wee():\n assert 1 != 2\n assert \"dog\" == func()",
"wee()"
] |
print "+%s+" % "hello"
print "+%d+" % 10
print "%c" % "a"
print '%c' % 34
print '%c' % 36
print '%d' % 10
print '%c' % 0x7f
| [
[
8,
0,
0.1429,
0.1429,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.2857,
0.1429,
0,
0.66,
0.1667,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.4286,
0.1429,
0,
0.66... | [
"print(\"+%s+\" % \"hello\")",
"print(\"+%d+\" % 10)",
"print(\"%c\" % \"a\")",
"print('%c' % 34)",
"print('%c' % 36)",
"print('%d' % 10)",
"print('%c' % 0x7f)"
] |
def a():
x = "OK"
print x
del x
print "after"
a()
| [
[
2,
0,
0.5,
0.8333,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
0,
2
],
[
14,
1,
0.3333,
0.1667,
1,
0.54,
0,
190,
1,
0,
0,
0,
0,
3,
0
],
[
8,
1,
0.5,
0.1667,
1,
0.54,
0.5,... | [
"def a():\n x = \"OK\"\n print(x)\n del x\n print(\"after\")",
" x = \"OK\"",
" print(x)",
" print(\"after\")",
"a()"
] |
import sys
print [x.replace("\\", "/") for x in sys.argv]
| [
[
1,
0,
0.5,
0.5,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"import sys",
"print([x.replace(\"\\\\\", \"/\") for x in sys.argv])"
] |
print range(10)[slice(0, 5, 2)]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
]
] | [
"print(range(10)[slice(0, 5, 2)])"
] |
print [y for x in range(10) for y in range(x)]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
]
] | [
"print([y for x in range(10) for y in range(x)])"
] |
print [x*y for x in range(1,10) for y in range(1,x) if y%2 == 0]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
]
] | [
"print([x*y for x in range(1,10) for y in range(1,x) if y%2 == 0])"
] |
class Stuff:
def __init__(self):
self.x = lambda: self.things()
def things(self):
print "OK"
y = Stuff()
y.x()
| [
[
3,
0,
0.4286,
0.7143,
0,
0.66,
0,
710,
0,
2,
0,
0,
0,
0,
2
],
[
2,
1,
0.3571,
0.2857,
1,
0.87,
0,
555,
0,
1,
0,
0,
0,
0,
1
],
[
14,
2,
0.4286,
0.1429,
2,
0.33,
... | [
"class Stuff:\n def __init__(self):\n self.x = lambda: self.things()\n def things(self):\n print(\"OK\")",
" def __init__(self):\n self.x = lambda: self.things()",
" self.x = lambda: self.things()",
" def things(self):\n print(\"OK\")",
" print(\"OK\")",... |
t = [[y*10+x for x in range(0,10)] for y in range(0,10)]
print t[2][3]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
15,
5,
0,
0,
0,
0,
0,
2
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"t = [[y*10+x for x in range(0,10)] for y in range(0,10)]",
"print(t[2][3])"
] |
print repr((1,2,3))
print repr([1,2,3])
print repr({1:'ok', 2:'stuff'})
print repr("weewaa")
| [
[
8,
0,
0.25,
0.25,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.5,
0.25,
0,
0.66,
0.3333,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.75,
0.25,
0,
0.66,
0.6667,... | [
"print(repr((1,2,3)))",
"print(repr([1,2,3]))",
"print(repr({1:'ok', 2:'stuff'}))",
"print(repr(\"weewaa\"))"
] |
s = set([2,3,4])
t = set([3,4,5])
u = set([1,3,5])
print s
s.intersection_update(t)
u.intersection_update(t)
print s
print u
print s == set([3, 4])
print u == set([3, 5])
t.intersection_update(s, u)
print t
print t == set([3])
| [
[
14,
0,
0.0526,
0.0526,
0,
0.66,
0,
553,
3,
1,
0,
0,
21,
10,
1
],
[
14,
0,
0.1053,
0.0526,
0,
0.66,
0.0833,
15,
3,
1,
0,
0,
21,
10,
1
],
[
14,
0,
0.1579,
0.0526,
0,
... | [
"s = set([2,3,4])",
"t = set([3,4,5])",
"u = set([1,3,5])",
"print(s)",
"s.intersection_update(t)",
"u.intersection_update(t)",
"print(s)",
"print(u)",
"print(s == set([3, 4]))",
"print(u == set([3, 5]))",
"t.intersection_update(s, u)",
"print(t)",
"print(t == set([3]))"
] |
if "x" is "x" or "y" is "y": print "OK"
| [] | [] |
a = 4
def test(z):
for i in range(0,a):
z += i
return z
print test(1)
| [
[
14,
0,
0.1667,
0.1667,
0,
0.66,
0,
475,
1,
0,
0,
0,
0,
1,
0
],
[
2,
0,
0.5833,
0.6667,
0,
0.66,
0.5,
224,
0,
1,
1,
0,
0,
0,
1
],
[
6,
1,
0.5833,
0.3333,
1,
0.22,
... | [
"a = 4",
"def test(z):\n for i in range(0,a):\n z += i\n return z",
" for i in range(0,a):\n z += i",
" return z",
"print(test(1))"
] |
print 123456
print 12345678987654321567
print repr(12345678987654321567)
| [
[
8,
0,
0.3333,
0.3333,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.3333,
0,
0.66,
1,... | [
"print(123456)",
"print(12345678987654321567)",
"print(repr(12345678987654321567))"
] |
class X: pass
x = X()
print getattr(x, 'wee', 14)
print getattr(X, 'doggy', 'OK')
| [
[
3,
0,
0.25,
0.25,
0,
0.66,
0,
783,
0,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.5,
0.25,
0,
0.66,
0.3333,
190,
3,
0,
0,
0,
783,
10,
1
],
[
8,
0,
0.75,
0.25,
0,
0.66,
0.6... | [
"class X: pass",
"x = X()",
"print(getattr(x, 'wee', 14))",
"print(getattr(X, 'doggy', 'OK'))"
] |
x=4
x|=1
print x
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
2,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x=4",
"print(x)"
] |
# Test the comparison of sets
print '# actual super & subsets'
sup = set([1,2,3,4,100])
print sup
sub = set([2,3,4])
print sub
print '# forwards'
print sup.isdisjoint(sub)
print sup > sub
print sup.issuperset(sub)
print sup >= sub
print sup == sub
print sup != sub
print sup.issubset(sub)
print sup <= sub
print sup < sub
print '# backwards'
print sub.isdisjoint(sup)
print sub > sup
print sub.issuperset(sup)
print sub >= sup
print sub == sup
print sub != sup
print sub.issubset(sup)
print sub <= sup
print sub < sup
| [
[
8,
0,
0.1,
0.0333,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.1667,
0.0333,
0,
0.66,
0.0417,
575,
3,
1,
0,
0,
21,
10,
1
],
[
8,
0,
0.2,
0.0333,
0,
0.66,
... | [
"print('# actual super & subsets')",
"sup = set([1,2,3,4,100])",
"print(sup)",
"sub = set([2,3,4])",
"print(sub)",
"print('# forwards')",
"print(sup.isdisjoint(sub))",
"print(sup > sub)",
"print(sup.issuperset(sub))",
"print(sup >= sub)",
"print(sup == sub)",
"print(sup != sub)",
"print(sup.... |
class X:
x = 4
x = X()
stuff = x.x
print stuff
things = X.x
print things
| [
[
3,
0,
0.1875,
0.25,
0,
0.66,
0,
783,
0,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.25,
0.125,
1,
0.9,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.5,
0.125,
0,
0.66,
0.2,
... | [
"class X:\n x = 4",
" x = 4",
"x = X()",
"stuff = x.x",
"print(stuff)",
"things = X.x",
"print(things)"
] |
print type(4)
print type(444444444444444444444)
print type(4.5)
| [
[
8,
0,
0.3333,
0.3333,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
1,
0.3333,
0,
0.66,
1,... | [
"print(type(4))",
"print(type(444444444444444444444))",
"print(type(4.5))"
] |
x = 1
while x < 3:
break
x = x + 1
print x
| [
[
14,
0,
0.2,
0.2,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
5,
0,
0.6,
0.6,
0,
0.66,
0.5,
0,
0,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.8,
0.2,
1,
0.35,
0,
190,
... | [
"x = 1",
"while x < 3:\n break\n x = x + 1",
" x = x + 1",
"print(x)"
] |
x=4
x=x*3
print x
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
190,
4,
0,
0,
0,
0,
0,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
... | [
"x=4",
"x=x*3",
"print(x)"
] |
s = set([2,3,4])
t = set([3,4,5])
u = set([1,3,5])
a = s.intersection(t)
b = u.intersection(s)
c = u.intersection(t)
print a
print b
print c
print a == set([3, 4])
print b == set([3])
print c == set([3, 5])
d = s.intersection(t, u)
print d
print d == set([3])
| [
[
14,
0,
0.05,
0.05,
0,
0.66,
0,
553,
3,
1,
0,
0,
21,
10,
1
],
[
14,
0,
0.1,
0.05,
0,
0.66,
0.0714,
15,
3,
1,
0,
0,
21,
10,
1
],
[
14,
0,
0.15,
0.05,
0,
0.66,
0... | [
"s = set([2,3,4])",
"t = set([3,4,5])",
"u = set([1,3,5])",
"a = s.intersection(t)",
"b = u.intersection(s)",
"c = u.intersection(t)",
"print(a)",
"print(b)",
"print(c)",
"print(a == set([3, 4]))",
"print(b == set([3]))",
"print(c == set([3, 5]))",
"d = s.intersection(t, u)",
"print(d)",
... |
print "imported modc"
stuff = 942
things = "squirrel"
| [
[
8,
0,
0.3333,
0.3333,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
686,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
1,
0.3333,
0,
0.66,
... | [
"print(\"imported modc\")",
"stuff = 942",
"things = \"squirrel\""
] |
print 2e9
print 2e10
print 1e9
print 1e10
print 1e8
print 1e7
| [
[
8,
0,
0.1667,
0.1667,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.3333,
0.1667,
0,
0.66,
0.2,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.5,
0.1667,
0,
0.66,
... | [
"print(2e9)",
"print(2e10)",
"print(1e9)",
"print(1e10)",
"print(1e8)",
"print(1e7)"
] |
print str(range(-8,-4))[:5]
print len(range(-8,-4))
print range(-8,-4)[0]
print range(-8,-4)[1]
print range(-8,-4)[-1]
| [
[
8,
0,
0.2,
0.2,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
],
[
8,
0,
0.4,
0.2,
0,
0.66,
0.25,
535,
3,
1,
0,
0,
0,
0,
3
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.5,
535,
... | [
"print(str(range(-8,-4))[:5])",
"print(len(range(-8,-4)))",
"print(range(-8,-4)[0])",
"print(range(-8,-4)[1])",
"print(range(-8,-4)[-1])"
] |
class A: pass
a = A()
print isinstance([], list)
print isinstance([], dict)
print isinstance([], str)
print isinstance([], tuple)
print isinstance([], A)
print "---"
print isinstance({}, list)
print isinstance({}, dict)
print isinstance({}, str)
print isinstance({}, tuple)
print isinstance({}, A)
print "---"
print isinstance("", list)
print isinstance("", dict)
print isinstance("", str)
print isinstance("", tuple)
print isinstance("", A)
print "---"
print isinstance((), list)
print isinstance((), dict)
print isinstance((), str)
print isinstance((), tuple)
print isinstance((), A)
print "---"
print isinstance(a, list)
print isinstance(a, dict)
print isinstance(a, str)
print isinstance(a, tuple)
print isinstance(a, A)
print "---"
| [
[
3,
0,
0.027,
0.027,
0,
0.66,
0,
429,
0,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0541,
0.027,
0,
0.66,
0.0323,
475,
3,
0,
0,
0,
429,
10,
1
],
[
8,
0,
0.1081,
0.027,
0,
0.66... | [
"class A: pass",
"a = A()",
"print(isinstance([], list))",
"print(isinstance([], dict))",
"print(isinstance([], str))",
"print(isinstance([], tuple))",
"print(isinstance([], A))",
"print(\"---\")",
"print(isinstance({}, list))",
"print(isinstance({}, dict))",
"print(isinstance({}, str))",
"pri... |
x = ('OK',)
print(x[0])
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = ('OK',)",
"print(x[0])"
] |
def test(y='K',x='Z'): print(x+y)
test('O')
| [
[
2,
0,
0.5,
0.5,
0,
0.66,
0,
224,
0,
2,
0,
0,
0,
0,
1
],
[
8,
1,
0.5,
0.5,
1,
0.81,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
224,
3,
... | [
"def test(y='K',x='Z'): print(x+y)",
"def test(y='K',x='Z'): print(x+y)",
"test('O')"
] |
print 7^2|4
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(7^2|4)"
] |
x = 'OK',
print x[0]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = 'OK',",
"print(x[0])"
] |
x = {'a':'OK'}
print x['a']
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
6,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = {'a':'OK'}",
"print(x['a'])"
] |
a = ()
print a
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"a = ()",
"print(a)"
] |
a = 1,
print a
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"a = 1,",
"print(a)"
] |
print "abc"[1.5]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(\"abc\"[1.5])"
] |
class Stuff:
def __init__(self):
def tmp():
self.things()
self.x = tmp
def things(self):
print "OK"
y = Stuff()
y.x()
| [
[
3,
0,
0.4444,
0.7778,
0,
0.66,
0,
710,
0,
3,
0,
0,
0,
0,
2
],
[
2,
1,
0.3889,
0.4444,
1,
0.13,
0,
555,
0,
1,
0,
0,
0,
0,
1
],
[
2,
2,
0.3889,
0.2222,
2,
0.76,
... | [
"class Stuff:\n def __init__(self):\n def tmp():\n self.things()\n self.x = tmp\n def things(self):\n print(\"OK\")",
" def __init__(self):\n def tmp():\n self.things()\n self.x = tmp",
" def tmp():\n self.things()",
" ... |
print "1,2,3".split(",").index("3")
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
]
] | [
"print(\"1,2,3\".split(\",\").index(\"3\"))"
] |
n = 0
for x in range(0,10,2):
n += 1
print n
| [
[
14,
0,
0.25,
0.25,
0,
0.66,
0,
773,
1,
0,
0,
0,
0,
1,
0
],
[
6,
0,
0.625,
0.5,
0,
0.66,
0.5,
190,
3,
0,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.25,
0,
0.66,
1,
535,... | [
"n = 0",
"for x in range(0,10,2):\n n += 1",
"print(n)"
] |
# to avoid constant-izing in python compiler
def doadd(a,b):
return a+b
def dosub(a,b):
return a-b
print doadd(123, 12345678987654321)
print doadd(-123, 12345678987654321)
print doadd(-123, -12345678987654321)
print doadd(123, -12345678987654321)
print dosub(123, 12345678987654321)
print dosub(12345678987654321, 123)
print dosub(-12345678987654321, 123)
print dosub(-12345678987654321, -123)
| [
[
2,
0,
0.1923,
0.1538,
0,
0.66,
0,
313,
0,
2,
1,
0,
0,
0,
0
],
[
13,
1,
0.2308,
0.0769,
1,
0.84,
0,
0,
4,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.3462,
0.1538,
0,
0.66,
... | [
"def doadd(a,b):\n return a+b",
" return a+b",
"def dosub(a,b):\n return a-b",
" return a-b",
"print(doadd(123, 12345678987654321))",
"print(doadd(-123, 12345678987654321))",
"print(doadd(-123, -12345678987654321))",
"print(doadd(123, -12345678987654321))",
"print(dosub(123, 123456789876... |
print 3,4,5
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
3,
0,
0,
0,
0,
1
]
] | [
"print(3,4,5)"
] |
print False == None
if not None:
print "This statement evaluates to True."
if None:
print "This statement evaluates to False."
| [
[
8,
0,
0.1667,
0.1667,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
4,
0,
0.5833,
0.3333,
0,
0.66,
0.5,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.6667,
0.1667,
1,
0.28,
... | [
"print(False == None)",
"if not None:\n print(\"This statement evaluates to True.\")",
" print(\"This statement evaluates to True.\")",
"if None:\n print(\"This statement evaluates to False.\")",
" print(\"This statement evaluates to False.\")"
] |
# Test the behaviour of sets
l = [1,2,3,4,1,1]
print l
s = set(l)
print s
# Test the addition and removal of items of a clone set
t = set(s)
print len(t), t
print len(s), s
t.add(100)
print len(t), t
print len(s), s
t.discard(2)
print len(t), t
print len(s), s
| [
[
14,
0,
0.125,
0.0625,
0,
0.66,
0,
810,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.1875,
0.0625,
0,
0.66,
0.0833,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.25,
0.0625,
0,
0.66,... | [
"l = [1,2,3,4,1,1]",
"print(l)",
"s = set(l)",
"print(s)",
"t = set(s)",
"print(len(t), t)",
"print(len(s), s)",
"t.add(100)",
"print(len(t), t)",
"print(len(s), s)",
"t.discard(2)",
"print(len(t), t)",
"print(len(s), s)"
] |
# test list comparisons
l = [1,2,3,1]
print l
print l > l
print l >= l
print l == l
print l != l
print l <= l
print l < l
| [
[
14,
0,
0.2222,
0.1111,
0,
0.66,
0,
810,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.3333,
0.1111,
0,
0.66,
0.1429,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.4444,
0.1111,
0,
0.6... | [
"l = [1,2,3,1]",
"print(l)",
"print(l > l)",
"print(l >= l)",
"print(l == l)",
"print(l != l)",
"print(l <= l)",
"print(l < l)"
] |
x = (1,3)
y = (1,3)
print {x:'OK'}[y]
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
304,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
... | [
"x = (1,3)",
"y = (1,3)",
"print({x:'OK'}[y])"
] |
x = 2
x ^= 7
print x
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
2,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = 2",
"print(x)"
] |
# Test set unions
# sets are un-ordered, though python seems to sort them sometimes...
# hence the testing for equality to known sets rather than printing.
s = set([2,3,4])
t = set([4,5,6])
u = set([1,2,3,4,5])
print s
print t
print u
print '# pair unions'
a = s.union(t)
b = s.union(u)
c = t.union(s)
d = t.union(u)
e = u.union(s)
f = u.union(t)
print a == c
print a == set([2,3,4,5,6])
print b == e
print b == set([1,2,3,4,5])
print d == f
print d == set([1,2,3,4,5,6])
print '# triple unions'
a = s.union(t, u)
b = s.union(u, t)
c = t.union(s, u)
d = t.union(u, s)
e = u.union(s, t)
f = u.union(t, s)
print f
print a == set([1,2,3,4,5,6])
print a == b
print a == c
print a == d
print a == e
print a == f
| [
[
14,
0,
0.1026,
0.0256,
0,
0.66,
0,
553,
3,
1,
0,
0,
21,
10,
1
],
[
14,
0,
0.1282,
0.0256,
0,
0.66,
0.0312,
15,
3,
1,
0,
0,
21,
10,
1
],
[
14,
0,
0.1538,
0.0256,
0,
... | [
"s = set([2,3,4])",
"t = set([4,5,6])",
"u = set([1,2,3,4,5])",
"print(s)",
"print(t)",
"print(u)",
"print('# pair unions')",
"a = s.union(t)",
"b = s.union(u)",
"c = t.union(s)",
"d = t.union(u)",
"e = u.union(s)",
"f = u.union(t)",
"print(a == c)",
"print(a == set([2,3,4,5,6]))",
"pr... |
def foo(x):
yield len(x)
yield len(x)
g = foo(range(5))
print g.next()
len = lambda y: 8
print g.next()
| [
[
2,
0,
0.25,
0.375,
0,
0.66,
0,
528,
0,
1,
0,
0,
0,
0,
2
],
[
8,
1,
0.25,
0.125,
1,
0.64,
0,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.375,
0.125,
1,
0.64,
1,
0,... | [
"def foo(x):\n yield len(x)\n yield len(x)",
" yield len(x)",
" yield len(x)",
"g = foo(range(5))",
"print(g.next())",
"len = lambda y: 8",
"print(g.next())"
] |
# Test that min & max work on dicts
d = {'foo':2, 'bar':3}
print d
print min(d)
print max(d)
| [
[
14,
0,
0.4,
0.2,
0,
0.66,
0,
355,
0,
0,
0,
0,
0,
6,
0
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.3333,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.8,
0.2,
0,
0.66,
0.6667,
... | [
"d = {'foo':2, 'bar':3}",
"print(d)",
"print(min(d))",
"print(max(d))"
] |
print [x*x for x in range(10) if x % 2 == 0]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print([x*x for x in range(10) if x % 2 == 0])"
] |
# Test the comparison of sets
l = [1,2,3,4,1,1]
print l
s = set(l)
print s
# Test the comparison of sets
print '# self'
print '# forwards'
print s.isdisjoint(s)
print s > s
print s.issuperset(s)
print s >= s
print s == s
print s != s
print s.issubset(s)
print s <= s
print s < s
print '# backwards'
print s.isdisjoint(s)
print s > s
print s.issuperset(s)
print s >= s
print s == s
print s != s
print s.issubset(s)
print s <= s
print s < s
| [
[
14,
0,
0.069,
0.0345,
0,
0.66,
0,
810,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.1034,
0.0345,
0,
0.66,
0.0417,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.1379,
0.0345,
0,
0.6... | [
"l = [1,2,3,4,1,1]",
"print(l)",
"s = set(l)",
"print(s)",
"print('# self')",
"print('# forwards')",
"print(s.isdisjoint(s))",
"print(s > s)",
"print(s.issuperset(s))",
"print(s >= s)",
"print(s == s)",
"print(s != s)",
"print(s.issubset(s))",
"print(s <= s)",
"print(s < s)",
"print('#... |
class X:
def stuff(self):
pass
x = X()
f = getattr(x, "stuff")
print f
fu = getattr(X, "stuff")
print fu
| [
[
3,
0,
0.25,
0.375,
0,
0.66,
0,
783,
0,
1,
0,
0,
0,
0,
0
],
[
2,
1,
0.3125,
0.25,
1,
0.21,
0,
686,
0,
1,
0,
0,
0,
0,
0
],
[
14,
0,
0.5,
0.125,
0,
0.66,
0.2,
... | [
"class X:\n def stuff(self):\n pass",
" def stuff(self):\n pass",
"x = X()",
"f = getattr(x, \"stuff\")",
"print(f)",
"fu = getattr(X, \"stuff\")",
"print(fu)"
] |
def wee(waa, woo=False, wii=True):
print "OK", waa, woo, wii
wee("stuff")
wee("stuff", "dog")
wee("stuff", "dog", "cat")
wee("stuff", wii="lamma")
wee(wii="lamma", waa="pocky")
wee(wii="lamma", waa="pocky", woo="blorp")
| [
[
2,
0,
0.1667,
0.2222,
0,
0.66,
0,
48,
0,
3,
0,
0,
0,
0,
1
],
[
8,
1,
0.2222,
0.1111,
1,
0.25,
0,
535,
3,
4,
0,
0,
0,
0,
1
],
[
8,
0,
0.4444,
0.1111,
0,
0.66,
... | [
"def wee(waa, woo=False, wii=True):\n print(\"OK\", waa, woo, wii)",
" print(\"OK\", waa, woo, wii)",
"wee(\"stuff\")",
"wee(\"stuff\", \"dog\")",
"wee(\"stuff\", \"dog\", \"cat\")",
"wee(\"stuff\", wii=\"lamma\")",
"wee(wii=\"lamma\", waa=\"pocky\")",
"wee(wii=\"lamma\", waa=\"pocky\", woo=\"bl... |
if not "?" in "xyz": print "OK"
| [] | [] |
print 7 in [1,2,3]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(7 in [1,2,3])"
] |
x = 4
print 1 != x < 9
print 1 != x > 9
print 4 != x < 9
print 4 == x > 9
print 4 == x < 9
print 4 == x < 9 < 14
print 4 == x < 9 < 14 > 10
print 4 == x < 9 < 14 < 10
| [
[
14,
0,
0.1111,
0.1111,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
8,
0,
0.2222,
0.1111,
0,
0.66,
0.125,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.3333,
0.1111,
0,
0.66... | [
"x = 4",
"print(1 != x < 9)",
"print(1 != x > 9)",
"print(4 != x < 9)",
"print(4 == x > 9)",
"print(4 == x < 9)",
"print(4 == x < 9 < 14)",
"print(4 == x < 9 < 14 > 10)",
"print(4 == x < 9 < 14 < 10)"
] |
print [1,2,"OK",4][-3:3][1]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
0,
6,
0,
0,
0,
0,
0,
0
]
] | [
"print [1,2,\"OK\",4][-3:3][1]"
] |
def f():
yield 1
yield 2
g = f()
print g.next()
print g.next()
for i in f():
print i
| [
[
2,
0,
0.25,
0.375,
0,
0.66,
0,
899,
0,
0,
0,
0,
0,
0,
0
],
[
8,
1,
0.25,
0.125,
1,
0.61,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
[
8,
1,
0.375,
0.125,
1,
0.61,
1,
0,... | [
"def f():\n yield 1\n yield 2",
" yield 1",
" yield 2",
"g = f()",
"print(g.next())",
"print(g.next())",
"for i in f():\n print(i)",
" print(i)"
] |
def wee():
print "from wee"
def waa():
print "from waa"
def woo():
print "from woo"
def blorp():
print "from blorp"
| [
[
2,
0,
0.1875,
0.25,
0,
0.66,
0,
48,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.25,
0.125,
1,
0.62,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
2,
0,
0.4375,
0.25,
0,
0.66,
0.3333,... | [
"def wee():\n print(\"from wee\")",
" print(\"from wee\")",
"def waa():\n print(\"from waa\")",
" print(\"from waa\")",
"def woo():\n print(\"from woo\")",
" print(\"from woo\")",
"def blorp():\n print(\"from blorp\")",
" print(\"from blorp\")"
] |
def f():
for i in 1,2,3,4,5:
if i == 3: break
yield i
print list(f())
| [
[
2,
0,
0.5,
0.8,
0,
0.66,
0,
899,
0,
0,
0,
0,
0,
0,
0
],
[
6,
1,
0.6,
0.6,
1,
0.63,
0,
826,
0,
0,
0,
0,
0,
0,
0
],
[
4,
2,
0.6,
0.2,
2,
0.7,
0,
0,
0,
... | [
"def f():\n for i in 1,2,3,4,5:\n if i == 3: break\n yield i",
" for i in 1,2,3,4,5:\n if i == 3: break\n yield i",
" if i == 3: break",
" yield i",
"print(list(f()))"
] |
def test():
global x
x = "OK"
test()
print x
| [
[
2,
0,
0.4,
0.6,
0,
0.66,
0,
224,
0,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.6,
0.2,
1,
0.84,
0,
190,
1,
0,
0,
0,
0,
3,
0
],
[
8,
0,
0.8,
0.2,
0,
0.66,
0.5,
224,
... | [
"def test():\n global x\n x = \"OK\"",
" x = \"OK\"",
"test()",
"print(x)"
] |
a = [100,101,102,103,104,105,106,107]
del a[:]
print a
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
2,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"a = [100,101,102,103,104,105,106,107]",
"print(a)"
] |
print 5&7
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(5&7)"
] |
print len({'a':1, 'b':2})
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(len({'a':1, 'b':2}))"
] |
print [1,2,3].index(3)
| [
[
8,
0,
1,
1,
0,
0.66,
0,
780,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print [1,2,3].index(3)"
] |
# Test that min & max work on sets
s = set([1,2,3])
print s
print min(s)
print max(s)
| [
[
14,
0,
0.4,
0.2,
0,
0.66,
0,
553,
3,
1,
0,
0,
21,
10,
1
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.3333,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.8,
0.2,
0,
0.66,
0.6667,
... | [
"s = set([1,2,3])",
"print(s)",
"print(min(s))",
"print(max(s))"
] |
a = 3
print a
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
475,
1,
0,
0,
0,
0,
1,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"a = 3",
"print(a)"
] |
import sys
sys.x = 4
sys.y = ["stuff"]
sys.z = {'things': sys.x}
print sys.x, sys.y, sys.z
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
14,
0,
0.4,
0.2,
0,
0.66,
0.25,
671,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.6,
0.2,
0,
0.66,
0.5,
3... | [
"import sys",
"sys.x = 4",
"sys.y = [\"stuff\"]",
"sys.z = {'things': sys.x}",
"print(sys.x, sys.y, sys.z)"
] |
a,b,d = [0],2,"OK"
print d
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
51,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"a,b,d = [0],2,\"OK\"",
"print(d)"
] |
def test(): return
x = 1
print test()
| [
[
2,
0,
0.3333,
0.3333,
0,
0.66,
0,
224,
0,
0,
0,
0,
0,
0,
0
],
[
13,
1,
0.3333,
0.3333,
1,
0.61,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.6667,
0.3333,
0,
0.66,
... | [
"def test(): return",
"def test(): return",
"x = 1",
"print(test())"
] |
def f():
for i in 1,2,3,4,5:
if i == 4: return
yield i
print list(f())
| [
[
2,
0,
0.5,
0.8,
0,
0.66,
0,
899,
0,
0,
0,
0,
0,
0,
0
],
[
6,
1,
0.6,
0.6,
1,
0.01,
0,
826,
0,
0,
0,
0,
0,
0,
0
],
[
4,
2,
0.6,
0.2,
2,
0.75,
0,
0,
0,
... | [
"def f():\n for i in 1,2,3,4,5:\n if i == 4: return\n yield i",
" for i in 1,2,3,4,5:\n if i == 4: return\n yield i",
" if i == 4: return",
" if i == 4: return",
" yield i",
"print(list(f()))"
] |
print 2 in {1:2}
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(2 in {1:2})"
] |
def f(n):
i = 0
yield i
i += 1
j = i
yield i
yield j
j *= 100
i += j
yield j
yield i
yield n + i
for i in f(10): # i to conflict with body
j = 999
print i
| [
[
2,
0,
0.4062,
0.75,
0,
0.66,
0,
899,
0,
1,
0,
0,
0,
0,
0
],
[
14,
1,
0.125,
0.0625,
1,
0.08,
0,
826,
1,
0,
0,
0,
0,
1,
0
],
[
8,
1,
0.1875,
0.0625,
1,
0.08,
0... | [
"def f(n):\n i = 0\n yield i\n i += 1\n j = i\n yield i\n yield j\n j *= 100",
" i = 0",
" yield i",
" j = i",
" yield i",
" yield j",
" yield j",
" yield i",
" yield n + i",
"for i in f(10): # i to conflict with body\n j = 999\n print(i)",
" ... |
a = [100,101,102,103,104,105,106,107]
del a[0]
print a
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
2,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"a = [100,101,102,103,104,105,106,107]",
"print(a)"
] |
class x():
pass
def f(x): return x
x.hi = f
print x.hi
| [
[
3,
0,
0.25,
0.3333,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.6667,
0.1667,
0,
0.66,
0.3333,
899,
0,
1,
1,
0,
0,
0,
0
],
[
13,
1,
0.6667,
0.1667,
1,
0.68,... | [
"class x():\n pass",
"def f(x): return x",
"def f(x): return x",
"x.hi = f",
"print(x.hi)"
] |
print str(range(0,5,3))[:5]
print len(range(0,5,3))
print range(0,5,3)[0]
print range(0,5,3)[1]
print range(0,5,3)[-1]
| [
[
8,
0,
0.2,
0.2,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
],
[
8,
0,
0.4,
0.2,
0,
0.66,
0.25,
535,
3,
1,
0,
0,
0,
0,
3
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.5,
535,
... | [
"print(str(range(0,5,3))[:5])",
"print(len(range(0,5,3)))",
"print(range(0,5,3)[0])",
"print(range(0,5,3)[1])",
"print(range(0,5,3)[-1])"
] |
x = [2,4,6]
print x[1]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = [2,4,6]",
"print(x[1])"
] |
a = [1,2,3,4,5,6]
b = [9,9,9]
a[1:2] = b
print a
| [
[
14,
0,
0.25,
0.25,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.5,
0.25,
0,
0.66,
0.3333,
756,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.75,
0.25,
0,
0.66,
0.66... | [
"a = [1,2,3,4,5,6]",
"b = [9,9,9]",
"a[1:2] = b",
"print(a)"
] |
x = (1,3)
print {x:'OK'}[x]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = (1,3)",
"print({x:'OK'}[x])"
] |
print 7^2&2
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(7^2&2)"
] |
# nl continuation
x = "stuff \
and \
things"
print x
| [
[
14,
0,
0.6667,
0.5,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
3,
0
],
[
8,
0,
1,
0.1667,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = \"stuff \\\nand \\\n things\"",
"print(x)"
] |
def test(x):
return x
y = test(1)*2 + test(3)*4 + test(5)*6
print y
| [
[
2,
0,
0.375,
0.5,
0,
0.66,
0,
224,
0,
1,
1,
0,
0,
0,
0
],
[
13,
1,
0.5,
0.25,
1,
0.04,
0,
0,
2,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.75,
0.25,
0,
0.66,
0.5,
304... | [
"def test(x):\n return x",
" return x",
"y = test(1)*2 + test(3)*4 + test(5)*6",
"print(y)"
] |
class Stuff:
def __init__(self):
print "OK"
"""
weewaa
"""
Stuff()
| [
[
3,
0,
0.5,
0.875,
0,
0.66,
0,
710,
0,
1,
0,
0,
0,
0,
1
],
[
2,
1,
0.3125,
0.25,
1,
0.13,
0,
555,
0,
1,
0,
0,
0,
0,
1
],
[
8,
2,
0.375,
0.125,
2,
0.66,
0,
... | [
"class Stuff:\n def __init__(self):\n print(\"OK\")\n \"\"\"\n weewaa\n\n \"\"\"",
" def __init__(self):\n print(\"OK\")",
" print(\"OK\")",
" \"\"\"\n weewaa\n\n \"\"\"",
"Stuff()"
] |
print min(3,8,2,6)
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(min(3,8,2,6))"
] |
def mygen(upto):
for i in range(0, upto):
print 'i',i
got = yield i
print 'got',got
handle = mygen(3)
first = True
for num in handle:
print 'num',num
if first:
print 'signalling'
foo = handle.send('sig')
print 'foo', foo
first = False
| [
[
2,
0,
0.2,
0.3333,
0,
0.66,
0,
56,
0,
1,
0,
0,
0,
0,
3
],
[
6,
1,
0.2333,
0.2667,
1,
0.83,
0,
826,
3,
0,
0,
0,
0,
0,
3
],
[
8,
2,
0.2,
0.0667,
2,
0.63,
0,
... | [
"def mygen(upto):\n for i in range(0, upto):\n print('i',i)\n got = yield i\n print('got',got)",
" for i in range(0, upto):\n print('i',i)\n got = yield i\n print('got',got)",
" print('i',i)",
" got = yield i",
" print('got',got)",
"handle = mygen(... |
def funky():
print "cheese"
def gen():
i = 0
funky()
yield 1
i += 1
g = gen()
print g.next()
| [
[
2,
0,
0.1364,
0.1818,
0,
0.66,
0,
700,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.1818,
0.0909,
1,
0.95,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
2,
0,
0.5455,
0.4545,
0,
0.66,
... | [
"def funky():\n print(\"cheese\")",
" print(\"cheese\")",
"def gen():\n i = 0\n funky()\n yield 1\n i += 1",
" i = 0",
" funky()",
" yield 1",
"g = gen()",
"print(g.next())"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.