A simple single line, triple-quoted comment is giving syntax error. Why?
Thomas 'PointedEars' Lahn
PointedEars at web.de
Sat Mar 21 23:14:05 EDT 2015
Denis McMahon wrote:
> However, you can't have multiple expressions on a line without some sort
> of operand or separator between them.
String concatenation is implicit in Python, but only with string *literals*:
| $ python
| Python 2.7.9 (default, Mar 1 2015, 12:57:24)
| [GCC 4.9.2] on linux2
| Type "help", "copyright", "credits" or "license" for more information.
| >>> 'foo' 'bar'
| 'foobar'
| $ python3
| Python 3.4.2 (default, Dec 27 2014, 13:16:08)
| [GCC 4.9.2] on linux
| Type "help", "copyright", "credits" or "license" for more information.
| >>> 'foo' 'bar'
| 'foobar'
They do not even have to be on the same line:
| $ python <<'EOT'
| print("foo"
| "bar")
| EOT
| foobar
| $ python3 <<'EOT'
| print("foo"
| "bar")
| EOT
| foobar
(I wished other programming languages had this feature.)
--
PointedEars
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
More information about the Python-list
mailing list