Skip to content

Instantly share code, notes, and snippets.

@pydanny
Created July 29, 2011 23:55
Show Gist options
  • Select an option

  • Save pydanny/1114993 to your computer and use it in GitHub Desktop.

Select an option

Save pydanny/1114993 to your computer and use it in GitHub Desktop.
The better way keeps me happy when dealing with complex code.
def sucky_way(x, y):
""" This sucks when the nesting gets deep"""
if x:
return 'Too hard things get all nested and stuff'
else:
y += 1
return y
def better_way(x, y):
""" Makes pydanny happy"""
if X:
return 'Keeping it clean'
y += 1
return y
@adamv
Copy link
Copy Markdown

adamv commented Jul 30, 2011

@pydanny
Copy link
Copy Markdown
Author

pydanny commented Jul 30, 2011

I learned the latter way during my Java days. It made dealing with giant nested ifs much easier. Same goes for the sort of Python I'm noodling through now. I'm paring and simplifying some really complex code into something legible and manageable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment