(Oct-19-2016, 01:40 PM)sparkz_alot Wrote:(Oct-19-2016, 12:56 PM)buran Wrote: Is it tuple? - What else do you think it is? :-)
Well,
Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved. C:\>python Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> a = print(()) () >>> type(a) <class 'NoneType'> >>> b = print(), >>> type(b) <class 'tuple'> >>> >>> c = print(()), () >>> type(c) <class 'tuple'> >>>
In your example a is None, because that is the default return value of each function.
b and c are single element tuples, because of that comma you add at the end of the line. Note that first and only element of the both is exactly the same None returned by the print function.
Hope the following example helps
Output:Python 3.5.2 (default, Jul 17 2016, 00:00:00)
[GCC 4.8.4] on linuxType "help", "copyright", "credits" or "license" for more information.
>>> a = print(())()
>>> print(print(()))
()
None
>>> b = print(),
>>> print(b)
(None,)
>>> c = print(()),
()
>>> print(c)
(None,)
Note the codeprint(print(()))and the output
Output:()
None
inner print function prints the tuple, then the outer functions prints the return value from the inner one - i.e. Nonesame as in this
Output:>>> print(print('something'))
something
None
>>>