I don\'t quite understand output received from:
print(print(print(\'aaa\')))
aaa
None
None
F
In python, when a function returns nothing explicitly, it returns None.
A function like print does an action but is not supposed to return anything, so it returns None. The print function could be something like this:
import sys
def print(*args, sep=' ', end='\n', file=sys.stdout, flush=False)
for arg in args:
file.write(str(arg))
if arg is not args[-1]:
file.write(str(sep))
file.write(str(end))
if flush:
sys.stdout.flush()
Which is equivalent to:
def print(*args, sep=' ', end='\n', file=sys.stdout, flush=False):
# The same code
return None
And in both cases you will get
>>> print('Hello world')
Hello world
>>> print(print('Hello world'))
Hello world
None
Hope this helps.