Well, I mean that if I type print(print("hello")) at the python command line, it literally returns hello and then on the next line, slightly indented, None.
Mar-19-2017, 02:11 AM (This post was last modified: Mar-19-2017, 02:13 AM by metulburr. Edited 2 times in total.)
All functions return None if not returning anything else. And in python3.x print is a function. The inner hello function runs, and prints hello. Then returns...which returns None. So the outer print becomes
Which that print outputs the return value of None.
*Describe the environment in which it occurs. *Describe the symptoms of your problem clearly.
*Describe the research you did to try and understand the problem. *Describe the goal, not the step.
*Use meaningful, specific subject headers *Write in clear, grammatical, correctly-spelled language
*Describe the problem's symptoms, not your guesses *Describe your problem's symptoms in chronological order
*Describe the diagnostic steps you took to try and pin down the problem yourself.
*Describe any possibly relevant recent changes in your computer or software configuration.
*Provide a way to reproduce the problem in a controlled environment.
What should it return? The text that was being printed to screen/file/network? A success/failure code?
It returns None, because it doesn't really make sense for it to return anything else. It does a thing, it doesn't change a thing.