Skip to content

Instantly share code, notes, and snippets.

@avindra
Created January 3, 2018 17:46
Show Gist options
  • Save avindra/93a079f486c6328960a8f5d22e4ae538 to your computer and use it in GitHub Desktop.
Save avindra/93a079f486c6328960a8f5d22e4ae538 to your computer and use it in GitHub Desktop.
Proof of python lacking lexical scope
#!/usr/bin/env python3
if True:
a = " am i lexically scoped?"
print(a)
print("exiting")
exit(0)
# imports can be used before they are
# defined
from sys import exit
from json import dumps
print("should never happen")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment