Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Arone Steele
957 PointsNot getting errors but I am curious
in print = my_tuple is there a difference to doing print(my_tuple) or does it not matter which way I do it?
# insert your code here
my_tuple = ('I', 'love', 'python')
print = my_tuple
1 Answer

Travis Alstrand
Treehouse Project ReviewerHey there Arone Steele ! π
Yes, there is a difference between the two. The way you have shown in your code block, print = my_tuple
will actually break your ability to use print afterwards. Here's an explanation:
You create a tuple and store it in
my_tuple
.You then reassign the name
print
so that it no longer refers to Pythonβs built-inprint()
function, it now points to your tuple.After that, if you try to do:
print(my_tuple)
youβll get an error like:
TypeError: 'tuple' object is not callable
because print
is no longer a function, itβs a tuple.
So overall:
print = my_tuple
means assign the tuple to the variable namedprint
, overriding the built-in function.print(my_tuple)
means call theprint
function and pass itmy_tuple
.
I hope this makes sense!