4 ms·
Tell HN: CodeSignal executes buggy, custom Python build
TLDR: weird treatment of global/nonlocal in CodeSignal, probably because they're wrapping the function.
I nearly lost a job offer today because CodeSignal does not execute 'real' Python.
Minimal example:
x = {}
def f():
global x
x['key'] = 'value'
f()
This will succeed in real python, but fail in CodeSignal. To make it work in CodeSignal, you need to change "global" to "nonlocal":
x = {}
def f():
nonlocal x
x['key'] = 'value'
f()
This will fail in Python! This should definitely come with a disclaimer on their site. It's criminal that you can write correct python and they can incorrectly mark your code as nonfunctional.
Perhaps I shouldn't give a minimal example, but only tell CodeSignal that their Python build was failing on my hidden test case...