From ef399c451b218310c498d27712cae9f307a77af5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Sun, 6 Aug 2017 11:34:40 +0200 Subject: [PATCH] trac 23551 adding explanation and doctest in the developer documentation --- src/doc/en/developer/coding_basics.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/doc/en/developer/coding_basics.rst b/src/doc/en/developer/coding_basics.rst index fc226c6257a..9e68120e9e0 100644 --- a/src/doc/en/developer/coding_basics.rst +++ b/src/doc/en/developer/coding_basics.rst @@ -862,6 +862,18 @@ written. 5 7 +- **Python3 print:** even if Python2 syntax for print can still be + used in your own code for the moment, Python3 syntax for print must + be used in Sage code and doctests. If you use an old-style print in + doctests, it will raise a SyntaxError:: + + sage: print "not like that" + Traceback (most recent call last): + ... + SyntaxError: invalid syntax + sage: print("but like this") + but like this + - **Split long lines:** You may want to split long lines of code with a backslash. Note: this syntax is non-standard and may be removed in the future::