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