[Tutor] Problem with print
David Hutto
smokefloat at gmail.com
Tue Dec 21 06:08:12 CET 2010
>
> 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.
However, it's declared as a NoneType in Python 3.1.2:
>>> x = print('test','test1')
test test1
>>> x
>>> type(x)
<class 'NoneType'>
>>>
I haven't gone further than that to test it's 'tupleness', or that
might not have been what you meant by it being 'interpreted as a
tuple'.
>
> Hugo
More information about the Tutor
mailing list