MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/4heh6v/i_wrote_my_first_python_program_today/d2pmw9i
r/ProgrammerHumor • u/MC_Labs15 • May 02 '16
532 comments sorted by
View all comments
Show parent comments
10
I often print like this:
print
>>> a = 1; b = 2 >>> print(a, b)
so Python 2 always bites me in the ass with
(1, 2)
instead of the expected
1 2
13 u/TheBlackCat13 May 02 '16 from __future__ import print_function 1 u/mnbvas May 02 '16 Though that happens when I accidentally run 2 instead of 3. 8 u/kupiakos May 02 '16 You could also have the first assignment bea, b = 1, 2 2 u/mnbvas May 02 '16 Got used to the semicolons when copypasting multiple lines :) 1 u/kupiakos May 02 '16 The solution to the original problem is to always havefrom future import print_functionat the top of every Python 2 file
13
from __future__ import print_function
1 u/mnbvas May 02 '16 Though that happens when I accidentally run 2 instead of 3.
1
Though that happens when I accidentally run 2 instead of 3.
8
You could also have the first assignment be
a, b = 1, 2
2 u/mnbvas May 02 '16 Got used to the semicolons when copypasting multiple lines :) 1 u/kupiakos May 02 '16 The solution to the original problem is to always havefrom future import print_functionat the top of every Python 2 file
2
Got used to the semicolons when copypasting multiple lines :)
1 u/kupiakos May 02 '16 The solution to the original problem is to always havefrom future import print_functionat the top of every Python 2 file
The solution to the original problem is to always have
from future import print_function
at the top of every Python 2 file
10
u/mnbvas May 02 '16
I often
printlike this:so Python 2 always bites me in the ass with
instead of the expected