summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-06-29 17:22:22 (GMT)
committerGitHub <noreply@github.com>2022-06-29 17:22:22 (GMT)
commit7244c57701d7f3f14605394b9e300a05b0f602b7 (patch)
treecce0f5dc6fc760d11f66e2f5633bbf8c996b2c68 /Doc
parent079ea445706e2afae8f1bcc53fe967b0839b310c (diff)
downloadcpython-7244c57701d7f3f14605394b9e300a05b0f602b7.zip
cpython-7244c57701d7f3f14605394b9e300a05b0f602b7.tar.gz
cpython-7244c57701d7f3f14605394b9e300a05b0f602b7.tar.bz2
Docs: Update SyntaxError message in REPL example for list comprehension (GH-93901) (GH-94426)
(cherry picked from commit 22b783aba05bcc3a21af9e5ae308ffbb98ff6a12) Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/tutorial/datastructures.rst6
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
index 927a672..a39dc83 100644
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -268,10 +268,10 @@ it must be parenthesized. ::
[(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), (5, 25)]
>>> # the tuple must be parenthesized, otherwise an error is raised
>>> [x, x**2 for x in range(6)]
- File "<stdin>", line 1, in <module>
+ File "<stdin>", line 1
[x, x**2 for x in range(6)]
- ^
- SyntaxError: invalid syntax
+ ^^^^^^^
+ SyntaxError: did you forget parentheses around the comprehension target?
>>> # flatten a list using a listcomp with two 'for'
>>> vec = [[1,2,3], [4,5,6], [7,8,9]]
>>> [num for elem in vec for num in elem]