Github Experimental restricted subset of Python for safe evaluation by @readevalprint
1.2972969999935913 ms
SnekRuntimeError("TypeError('cannot unpack non-iterable NoneType object')")

Previous Evaluation

a = ["hi", "world"]
" ".join(a)
[None, 'hi world']
Link time elapsed: 0.772 ms
x = 10
def foo():
    print(x)
    x += 1
    return x
foo()
[None, None, 11]
Link time elapsed: 2.105 ms
x = 10
def foo():
    print(x)
    x += 1
    
foo()
[None, None, None]
Link time elapsed: 2.046 ms
l = [0,1,2,3,4,65,7,8,9,19,43,25,6,743,2,3,3,651,1]
print({v: v**3 for v in l})
[None, None]
Link time elapsed: 3.879 ms
a = ["hi", "world"]
" ".join(a)
while True:
	pass
SnekRuntimeError("TimeoutError('This program has too many evaluations')")
Link time elapsed: 113.073 ms
l = [0,1,2,3,4,65,7,8,9,19,43,25,6,743,2,3,3,651,1]
{v: v**3 for v in l}
[None,
 {0: 0,
  1: 1,
  2: 8,
  3: 27,
  4: 64,
  6: 216,
  7: 343,
  8: 512,
  9: 729,
  19: 6859,
  25: 15625,
  43: 79507,
  65: 274625,
  651: 275894451,
  743: 410172407}]
Link time elapsed: 4.154 ms
l = [0,1,2,3,4,65,7,8,9]*10
{v: v**3 for v in l}
l
[None,
 {0: 0, 1: 1, 2: 8, 3: 27, 4: 64, 7: 343, 8: 512, 9: 729, 65: 274625},
 [0,
  1,
  2,
  3,
  4,
  65,
  7,
  8,
  9,
  0,
  1,
  2,
  3,
  4,
  65,
  7,
  8,
  9,
  0,
  1,
  2,
  3,
  4,
  65,
  7,
  8,
  9,
  0,
  1,
  2,
  3,
  4,
  65,
  7,
  8,
  9,
  0,
  1,
  2,
  3,
  4,
  65,
  7,
  8,
  9,
  0,
  1,
  2,
  3,
  4,
  65,
  7,
  8,
  9,
  0,
  1,
  2,
  3,
  4,
  65,
  7,
  8,
  9,
  0,
  1,
  2,
  3,
  4,
  65,
  7,
  8,
  9,
  0,
  1,
  2,
  3,
  4,
  65,
  7,
  8,
  9,
  0,
  1,
  2,
  3,
  4,
  65,
  7,
  8,
  9]]
Link time elapsed: 20.735 ms
l = [0,1,2,3,4,65,7,8,9]*10
{v: v**3 for v in l}
1
[None, {0: 0, 1: 1, 2: 8, 3: 27, 4: 64, 7: 343, 8: 512, 9: 729, 65: 274625}, 1]
Link time elapsed: 19.726 ms
l = [0,1,2,3,4,65,7,8,9]*10
{v: v**3 for v in l}
[None, {0: 0, 1: 1, 2: 8, 3: 27, 4: 64, 7: 343, 8: 512, 9: 729, 65: 274625}]
Link time elapsed: 17.068 ms
a = ["hi", "world"] * 32


while True:
	a = [a,a] * 16
SnekRuntimeError("MemoryError('Sorry, I will not evalute something that long.')")
Link time elapsed: 36.079 ms
a, b = 0, 1
while a < 10:
    a, b = b, a+b
    
a
[None, None, 13]
Link time elapsed: 4.716 ms
(lambda f: f)(1)
[1]
Link time elapsed: 1.096 ms
(lambda f: 1)()
SnekRuntimeError('TypeError("<lambda>() missing a required argument: \'f\'")')
Link time elapsed: 1.958 ms
result = []
def my_decorator(log):
    result.append(f"d1 {log}")
    def _wrapper(func):
        result.append(f"_wrapper {log}")
        def _inner(*args, **kwargs):
            result.append(f"inner {log}")
            func(*args, **kwargs)
        return _inner
    return _wrapper
    
@my_decorator(1)
@my_decorator(2)
def say(word=None):
    result.append(word or "hi world!")
say()
say('ola mundo')
result
[None,
 None,
 None,
 None,
 None,
 ['d1 1',
  'd1 2',
  '_wrapper 2',
  '_wrapper 1',
  'inner 1',
  'inner 2',
  'hi world!',
  'inner 1',
  'inner 2',
  'ola mundo']]
Link time elapsed: 12.474 ms
a = 1
b = 2
exc_1, exc_2 = None, None

try:
	assert a == 1
except Exception as e:
	exc_1 = f"first exception {e}"
try:
	assert a == b
except Exception as e:
	exc_2 = f"False assertion: a == b"
	
exc_1
exc_2
[None, None, None, None, None, None, 'False assertion: a == b']
Link time elapsed: 1.466 ms
a = 1
b = 2
exc_1, exc_2 = None, None

try:
	assert a == 1
except Exception as e:
	exc_1 = f"first exception {e}"
try: assert a == b
except Exception as e: exc_2 = f"second exception {e}"
	
exc_1
exc_2
[None, None, None, None, None, None, 'second exception AssertionError()']
Link time elapsed: 1.642 ms
a = 1
b = 2
exc_1, exc_2 = None, None

try:
	assert a == 1
except Exception as e:
	exc_1 = f"first exception {e}"
try: assert a == b; except Exception as e: exc_2 = f"second exception {e}"
	
exc_1
exc_2
SnekRuntimeError('SyntaxError(\'invalid syntax\', (\'<unknown>\', 9, 21, \'try: assert a == b; except Exception as e: exc_2 = f"second exception {e}"\\n\'))')
Link time elapsed: 0.648 ms
a = 1
b = 2
exc_1, exc_2 = None, None

try:
	assert a == 1
except Exception as e:
	exc_1 = f"first exception {e}"
try: assert a == b; except Exception as e:mexc_2 = f"second exception {e}"
	
exc_1
exc_2
SnekRuntimeError('SyntaxError(\'invalid syntax\', (\'<unknown>\', 9, 21, \'try: assert a == b; except Exception as e:mexc_2 = f"second exception {e}"\\n\'))')
Link time elapsed: 0.208 ms
a = 1
b = 2
exc_1, exc_2 = None, None

try:
	assert a == 1
except Exception as e:
	exc_1 = f"first exception {e}"
try:
	assert a == b
except Exception as e:
	exc_2 = f"second exception {e}"
	
exc_1
exc_2
[None, None, None, None, None, None, 'second exception AssertionError()']
Link time elapsed: 88.900 ms
a = 1
b = 2
exc_1, exc_2 = None

try:
	assert a == 1
except Exception as e:
	exc_1 = f"first exception {e}"
try:
	assert a == b
except Exception as e:
	exc_2 = f"second exception {e}"
	
exc_1
exc_2
SnekRuntimeError("TypeError('cannot unpack non-iterable NoneType object')")
Link time elapsed: 1.297 ms
a = 1
b = 2
try:
	assert a == 1
except Exception as e:
	exc_1 = f"first exception {e}"
try:
	assert a == b
except Exception as e:
	exc_2 = f"second exception {e}"
	
exc_1
exc_2
SnekRuntimeError('NameError("\'exc_1\' is not defined")')
Link time elapsed: 1.164 ms
try:
	a = 1
	b = 2
	assert a == b
except Exception as e:
	exc = f"exception {e}"
	
exc
e
[None, 'exception AssertionError()', SnekRuntimeError('AssertionError()')]
Link time elapsed: 1.673 ms
try:
	a = 1
	b = 2
	assert a == 1
except Exception as e:
	exc = f"exception {e}"
	
exc
e
SnekRuntimeError('NameError("\'exc\' is not defined")')
Link time elapsed: 1.013 ms
a = ["hi", "world"]
" ".join(a)
import os
print(os.listdir())
SnekRuntimeError("ModuleNotFoundError('os')")
Link time elapsed: 0.800 ms
a = b,c= 1,2
a,b,c
[None, ((1, 2), 1, 2)]
Link time elapsed: 1.176 ms
a = b,c= 1,2
[None]
Link time elapsed: 7.585 ms
def x(a): a

x
[None, <function x at 0x3e940046ef70>]
Link time elapsed: 1.253 ms
assert False
SnekRuntimeError('AssertionError()')
Link time elapsed: 0.582 ms
raise Exception()
SnekRuntimeError('Exception()')
Link time elapsed: 0.432 ms
twice = lambda x: x * 2

twice(1)
twice(2)
twice(3)
twice("abc")
[None, 2, 4, 6, 'abcabc']
Link time elapsed: 3.222 ms
lambda f: 1
[<function <lambda> at 0x3e93fe29a1f0>]
Link time elapsed: 0.940 ms
try:
	a = 1
	b = 2
	assert a == 1
	assert a == b
except Exception as e:
	exc = f"exception {dir(e)}"
	
exc
e
SnekRuntimeError('NameError("\'dir\' is not defined")')
Link time elapsed: 1.222 ms
try:
	a = 1
	b = 2
	assert a == 1
	assert a == b
except Exception as e:
	exc = f"exception {e}"
	
exc
e
[None, 'exception AssertionError()', SnekRuntimeError('AssertionError()')]
Link time elapsed: 1.397 ms
try:
	a = 1
	b = 2
	assert a == b
	assert a == None
except Exception as e:
	exc = f"exception {e}"
	
exc
e
[None, 'exception AssertionError()', SnekRuntimeError('AssertionError()')]
Link time elapsed: 1.393 ms
try:
	a = 1
	b = 2
	assert a == b
	assert a == None
except Exception as e:
	exc = f"exception {e}"
	
exc
[None, 'exception AssertionError()']
Link time elapsed: 1.564 ms
try:
	assert False, "False"
except Exception as e:
	exc_1 = f"first exception {e}"
try:
	assert False
except Exception as e:
	exc_2 = f"second exception {e}"
	
exc_1
exc_2
[None,
 None,
 "first exception AssertionError('False')",
 'second exception AssertionError()']
Link time elapsed: 1.707 ms
assert 1 == 2, "nope"
SnekRuntimeError("AssertionError('nope')")
Link time elapsed: 0.524 ms
try:
	try:
		assert False, "False"
	except Exception as e:
		exc_1 = f"first exception {e}"
		raise Exception(exc_1) from e
except Exception as e:
	exc_2 = f"second exception {e}"
	
exc_1
exc_2
[None,
 "first exception AssertionError('False')",
 'second exception Exception("first exception AssertionError(\'False\')")']
Link time elapsed: 1.794 ms
try:
	assert False, "False"
except Exception as e:
	exc_1 = f"first exception {e}"
try:
	assert False, "False"
except Exception as e:
	exc_2 = f"second exception {e}"
	
exc_1
exc_2
[None,
 None,
 "first exception AssertionError('False')",
 "second exception AssertionError('False')"]
Link time elapsed: 1.796 ms
assert True, "True"
assert False, "False"
assert None
SnekRuntimeError("AssertionError('False')")
Link time elapsed: 4.147 ms
def ok():
	ok()
	
ok()
SnekRuntimeError("RecursionError('Sorry, stack is to large. The MAX_CALL_DEPTH is 32.')")
Link time elapsed: 6.623 ms
def dict_generator(indict, pre=None):
    out = []
    pre = pre[:] if pre else []
    if isinstance(indict, dict):
        for key, value in indict.items():
            if isinstance(value, dict):
                for d in dict_generator(value, [key] + pre):
                    out = out + d
            elif isinstance(value, list) or isinstance(value, tuple):
                for v in value:
                    for d in dict_generator(v, [key] + pre):
                        out = out + d
            else:
                pre + [key, value]
    else:
        out = out + [indict]
    return out
    
dict_generator({"a": [1,2,3]})
SnekRuntimeError('TypeError(\'can only concatenate list (not "int") to list\')')
Link time elapsed: 5.338 ms
raise Exception("hey")
SnekRuntimeError("Exception('hey')")
Link time elapsed: 0.418 ms
try:
	assert False, "foo"
except Exception as e:
	exc = e
exc
	
[None, SnekAssertionError('foo')]
Link time elapsed: 0.790 ms
try:
	assert False, "foo"
except Exception as e:
	e
[None]
Link time elapsed: 1.025 ms
assert False, "foo"
SnekAssertionError('foo')
Link time elapsed: 0.416 ms
assert False
SnekAssertionError('')
Link time elapsed: 0.334 ms
assert 1 == 2
SnekAssertionError('')
Link time elapsed: 0.385 ms
def dict_generator(indict, pre=None):
    out = []
    pre = pre[:] if pre else []
    if isinstance(indict, dict):
        for key, value in indict.items():
            if isinstance(value, dict):
                for d in dict_generator(value, [key] + pre):
                    out = out + d
            elif isinstance(value, list) or isinstance(value, tuple):
                for i, v in enumerate(value):
                    for d in dict_generator(v, pre + [key, i]):
                        out = out + [d]
            else:
    			out = out + [(pre, indict)]
    else:
        out = out + [(pre, indict)]
    return out
    
dict_generator({"a": [1,{"b": [4,5,{"c": "C"}]},3]})
TabError('inconsistent use of tabs and spaces in indentation', ('<unknown>', 14, 35, '    \t\t\tout = out + [(pre, indict)]\n'))
Link time elapsed: 135.825 ms
def dict_generator(indict, pre=None):
    out = []
    pre = pre[:] if pre else []
    if isinstance(indict, dict):
        for key, value in indict.items():
            if isinstance(value, dict):
                for d in dict_generator(value, [key] + pre):
                    out = out + d
            elif isinstance(value, list) or isinstance(value, tuple):
                for i, v in enumerate(value):
                    for d in dict_generator(v, pre + [key, i]):
                        out = out + [d]
            else:
                out = out + [key, value]
    else:
        out = out + [(pre, indict)]
    return out
    
dict_generator({"a": [1,{"b": [4,5,{"c": "C"}]},3]})
[None,
 [(['a', 0], 1),
  (['a', 1, 'b', 0], 4),
  (['a', 1, 'b', 1], 5),
  'c',
  'C',
  (['a', 2], 3)]]
Link time elapsed: 17.758 ms
def dict_generator(indict, pre=None):
    out = []
    pre = pre[:] if pre else []
    if isinstance(indict, dict):
        for key, value in indict.items():
            if isinstance(value, dict):
                for d in dict_generator(value, [key] + pre):
                    out = out + d
            elif isinstance(value, list) or isinstance(value, tuple):
                for i, v in enumerate(value):
                    for d in dict_generator(v, pre + [key, i]):
                        out = out + [d]
            else:
                out = pre + [key, value]
    else:
        out = out + [(pre, indict)]
    return out
    
dict_generator({"a": [1,{"b": [4,5,{"c": "C"}]},3]})
[None,
 [(['a', 0], 1),
  (['a', 1, 'b', 0], 4),
  (['a', 1, 'b', 1], 5),
  'a',
  1,
  'b',
  2,
  'c',
  'C',
  (['a', 2], 3)]]
Link time elapsed: 41.486 ms
assert false
NameNotDefined("'false' is not defined")
Link time elapsed: 15.317 ms
def ok:
	pass
SyntaxError('invalid syntax', ('<unknown>', 1, 7, 'def ok:\n'))
Link time elapsed: 0.143 ms
class ok:
	pass
FeatureNotAvailable('Sorry, ClassDef is not available in this evaluator')
Link time elapsed: 30.589 ms
_
NameNotDefined("'_' is not defined")
Link time elapsed: 72.665 ms
locals()
NameNotDefined("'locals' is not defined")
Link time elapsed: 0.339 ms
print(locals())
NameNotDefined("'print' is not defined")
Link time elapsed: 0.816 ms
MAX_CALL_DEPTH = 100
def ok():
	ok()
	
ok()
CallTooDeep('Sorry, stack is to large. The MAX_CALL_DEPTH is 32.')
Link time elapsed: 6.926 ms
for x in range(10000):
	_ = ""
NameNotDefined("'range' is not defined")
Link time elapsed: 0.477 ms
for x in xrange(10000000):
	_ = ""
NameNotDefined("'xrange' is not defined")
Link time elapsed: 103.044 ms
for x in range(10000000):
	_ = ""
NameNotDefined("'range' is not defined")
Link time elapsed: 36.122 ms
a = ["hi", "world"]
" ".join(a)
while True:
	_ = ""
TooManyEvaluations('This program has too many evaluations')
Link time elapsed: 328.077 ms
a = ["hi", "world"]
" ".join(a)
import sys
SnekImportError('sys')
Link time elapsed: 84.272 ms
a = ["hi", "world"]
" ".join(a)
import time
time.localtime()
SnekImportError('time')
Link time elapsed: 91.742 ms
"To the Moon"
['To the Moon']
Link time elapsed: 0.570 ms
print("To the Moon")
NameNotDefined("'print' is not defined")
Link time elapsed: 24.365 ms
a = ["hi", "world"]
" ".join(a)

eval('"Hello"')
NameNotDefined("'eval' is not defined")
Link time elapsed: 45.548 ms
def x(a): a

x

a = f"{().__class__}"
FeatureNotAvailable('Sorry, access to this attribute is not available. (__class__)')
Link time elapsed: 1.293 ms
def x(a): a

x

a = f"{().__class__.__base__}"
FeatureNotAvailable('Sorry, access to this attribute is not available. (__base__)')
Link time elapsed: 1.468 ms
a = (1)

a = (1, a)

a
[None, None, (1, 1)]
Link time elapsed: 52.516 ms
a = (1)

a = (1, a)
[None, None]
Link time elapsed: 0.569 ms
a = ["hi", "world"]

a.append(a);

a
[None, None, ['hi', 'world', <Recursion on list with id=69094979933440>]]
Link time elapsed: 0.844 ms
a = ["hi", "world"] * 32


while True:
	a = [a,a] * 32
SnekArithmeticError('Sorry, I will not evalute something that long.')
Link time elapsed: 55.349 ms
a = ["hi", "world"] * 32


while True:
	a = [a,a,a,a,a] * 6
ScopeTooLarge('Scope has used too much memory: 29543 > 20000.0')
Link time elapsed: 87.139 ms
a = ["hi", "world"] * 10


while True:
	a = [a,a,a,a,a] * 6
ScopeTooLarge('Scope has used too much memory: 27993 > 20000.0')
Link time elapsed: 3.111 ms
a = ["hi", "world"]


while True:
	a = [a,a,a,a,a] * 8
SnekArithmeticError('Sorry, I will not evalute something that long.')
Link time elapsed: 2.780 ms
a = ["hi", "world"]


while True:
	a = [a,a,a,a,a] * 6
ScopeTooLarge('Scope has used too much memory: 31343 > 20000.0')
Link time elapsed: 6.559 ms
a = ["hi", "world"]


while True:
	a = [a,a,a,a,a] * 4
ScopeTooLarge('Scope has used too much memory: 41673 > 20000.0')
Link time elapsed: 8.466 ms
a = ["hi", "world"]


while True:
	a = [a,a] * 16
ScopeTooLarge('Scope has used too much memory: 35567 > 20000.0')
Link time elapsed: 7.165 ms
a = ["hi", "world"]


while True:
	a = [a,a] * 32
SnekArithmeticError('Sorry, I will not evalute something that long.')
Link time elapsed: 1.835 ms
a = ["hi", "world"]


while True:
	a = [a,a] * 36
SnekArithmeticError('Sorry, I will not evalute something that long.')
Link time elapsed: 1.805 ms
a = ["hi", "world"]


while True:
	a = a * 36
ScopeTooLarge('Scope has used too much memory: 20603 > 20000.0')
Link time elapsed: 1.275 ms
a = ["hi", "world"]


while True:
	a = a * 37
SnekArithmeticError('Sorry, I will not evalute something that long.')
Link time elapsed: 1.565 ms
a = ["hi", "world"]


while True:
	a = a * 38
SnekArithmeticError('Sorry, I will not evalute something that long.')
Link time elapsed: 0.977 ms
a = ["hi", "world"]


while True:
	a = a * 40
SnekArithmeticError('Sorry, I will not evalute something that long.')
Link time elapsed: 0.838 ms
a = ["hi", "world"]


while True:
	a = a * 50
SnekArithmeticError('Sorry, I will not evalute something that long.')
Link time elapsed: 0.922 ms
a = ["hi", "world"]


while True:
	a = a * 33
ScopeTooLarge('Scope has used too much memory: 33293 > 20000.0')
Link time elapsed: 3.204 ms
a = ["hi", "world"]


while True:
	a = a * 32
ScopeTooLarge('Scope has used too much memory: 31343 > 20000.0')
Link time elapsed: 4.882 ms
a = ["hi", "world"]


while True:
	a = a * 10
ScopeTooLarge('Scope has used too much memory: 30623 > 20000.0')
Link time elapsed: 10.083 ms
a = ["hi", "world"]


while True:
	a = a * 100
SnekArithmeticError('Sorry, I will not evalute something that long.')
Link time elapsed: 2.455 ms
a = ["hi", "world"]


while True:
	a = a * 2
ScopeTooLarge('Scope has used too much memory: 23663 > 20000.0')
Link time elapsed: 5.551 ms
a = ["hi", "world"]

a.len()

a = a * 2**32

" ".join(a)
SnekAttributeError("'list' object has no attribute 'len'")
Link time elapsed: 0.724 ms
a = ["hi", "world"]

a.__len__()
FeatureNotAvailable('Sorry, access to this attribute is not available. (__len__)')
Link time elapsed: 0.693 ms
a = ["hi", "world"]

delattr(a, '__len__')

a = a * 2**32

" ".join(a)
NameNotDefined("'delattr' is not defined")
Link time elapsed: 90.597 ms
a = ["hi", "world"]

delattr(a, '__len__')

a = * 2**32

" ".join(a)
SyntaxError("can't use starred expression here", ('<string>', 5, 4, None))
Link time elapsed: 81.497 ms
a = ["hi", "world"] * 2**32
" ".join(a)
SnekArithmeticError('Sorry, I will not evalute something that long.')
Link time elapsed: 22.853 ms
a = ["hi", "world"]

x = self

" ".join(a)
NameNotDefined("'self' is not defined")
Link time elapsed: 0.637 ms
a = ["hi", "world"]

x = open

" ".join(a)
NameNotDefined("'open' is not defined")
Link time elapsed: 0.568 ms
a = ["hi", "world"]

x = eval

" ".join(a)
NameNotDefined("'eval' is not defined")
Link time elapsed: 1.361 ms
def foo():
	try:
		return foo()
	except Exception as e:
		return e
	
foo()
[None, CallTooDeep('Sorry, stack is to large. The MAX_CALL_DEPTH is 32.')]
Link time elapsed: 28.230 ms