Why print command gives a new line even though there is no data to print
<p>Just typing <code>print</code> only gives newline in python.  Typing <code>print</code> without the brackets in 3.x will also gives a newline. Why?</p>

<p>It is interesting how languages differ in this.  </p>

<p><code>print</code> in the Korn shell (ksh) has the same behaviour as <code>python</code>, i.e. it adds a newline.  Bash does not have a <code>print</code>, relying on <code>echo</code> instead, which also adds a newline (which, like python, can be suppressed).</p>

<p><code>print</code> in Perl does not, and caused so much inconvenience that another version, called <code>say</code>, was added which does add a newline.  </p>

<p>Ruby and PHP are like Perl in that <code>print</code> also does not add a newline.  This of course is less of an issue when embedded in HTML.</p>

<p>If you look at other languages, for example <a href="http://c2.com/cgi/wiki?HelloWorldInManyProgrammingLanguages" rel="nofollow">here</a> you will find opinion divided as to whether a newline should be added or not.  The removal of the newline in Python is discussed in <a href="https://www.python.org/dev/peps/pep-0259/" rel="nofollow">PEP259</a>.</p>

python python-2.7 python-3.x