Re:Anyprint: use any language's print statements in Python
by Veedrac on Wednesday July 19, 2017 @01:46PM
(#14806256)
Little known fact: The addition of `exec`-with-parenthesis actually long predates Python 3. Python 3 just removed the old, braceless version.
That this is so little known is why we have a complicated future.exec_, which is entirely needless! (https://stackoverflow.com/a/26098101/1763356)
Re:Anyprint: use any language's print statements in Python
by masklinn on Wednesday July 19, 2017 @02:51PM
(#14806820)
> Little known fact: The addition of `exec`-with-parenthesis actually long predates Python 3. Python 3 just removed the old, braceless version.
That's not really true, although the syntactic compatibility does make for conveniently trivial cross-compatible code, Python 3 did not "remove the old, braceless version" it converted exec from a keyword (which could accept a single tuple parameter) to a builtin function (which takes up to 3 parameters). Which had the side-effect of requiring parenthesis.
Incidentally, the print-tuple-trick is cute, I hadn't considered it.
Er… what?
Python doesn't have braces, it has plenty of parenthesis. In fact, Python 3 added more since it upgraded several keywords to functions (not just print but also exec, and some forms of re-raising)