Skip to content

Instantly share code, notes, and snippets.

@litzomatic
Created May 18, 2012 20:51
Show Gist options
  • Save litzomatic/2727546 to your computer and use it in GitHub Desktop.
Save litzomatic/2727546 to your computer and use it in GitHub Desktop.
Python: A bug waiting to happen.
# Oh yeah these and print anything with a __str__, right?
string_formating = 'This is not cool %s'
format_string = 'This is very cool {}'
# Wrong, wrong, wrong...
input = ('since', 'I', 'can', 'do', 'this')
print format_string.format(input)
# There is a reason this is second :)
print string_formating % input
# Of course, if we could predict the future this a new Python programmer could have done
# print string_formatin % (input,)
# But to expect that mistake to be avoided consistently, is ludicrous
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment