Skip to content

Instantly share code, notes, and snippets.

@boylea
Created October 3, 2015 23:12
Show Gist options
  • Save boylea/fedeaeec764bd57277d4 to your computer and use it in GitHub Desktop.
Save boylea/fedeaeec764bd57277d4 to your computer and use it in GitHub Desktop.
An example of abusing python indentation syntax. Python is enforces correct indentation at a block, but if you try (or are grossly negligent) you can make it look really bad.
uglystick = True
def ugly_python():
if uglystick:
print "one space"
if uglystick:
print 'five space'
def more_uglyness():
if uglystick:
print 'two space x2'
if True:
print 'how far is this even indented'
else
print 'Else MUST match at least'
def spacey_function():
print "here I am"
if True:
"alone again"
def tight_function():
print 'Cozy in here'
if True:
"don't do this"
# I was going to include a example of mixed tabs + spaces, but we all know
# that's bad, and sublime text seems to be really good at not letting me do
# that to myself
if uglystick:
ugly_python()
more_uglyness()
spacey_function()
tight_function()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment