Created
May 18, 2012 20:51
-
-
Save litzomatic/2727546 to your computer and use it in GitHub Desktop.
Python: A bug waiting to happen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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