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