[Tutor] Problem with print

Hugo Arts hugo.yoshi at gmail.com
Tue Dec 21 06:00:15 CET 2010


On Tue, Dec 21, 2010 at 5:35 AM, David Hutto <smokefloat at gmail.com> wrote:
>
> I was used to the tutorials from 3 showing the correct print(), and
> seeing the errors for print 'whatever', when i accidentally used them
> in 3, that I used them exclusively after seeing the 3 tutorials, and
> that it could be used as both a function and a statement(correct me if
> the term is wrong) in 2.
>

Note that print can actually only be used as a statement in python 2.
It just so happens that you can include parentheses in the statement.
Though that makes it look similar to a function call, it certainly is
not. You'll see that when you try to supply multiple arguments to the
"function." This makes python suddenly interpret the parentheses as a
tuple, making it obviously not a function call.

Hugo


More information about the Tutor mailing list