From: Cheryl Sabella Date: Wed, 29 Jun 2022 17:06:51 +0000 (-0400) Subject: Docs: Update SyntaxError message in REPL example for list comprehension (GH-93901) X-Git-Tag: v3.12.0a1~1069 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=22b783aba05bcc3a21af9e5ae308ffbb98ff6a12;p=thirdparty%2FPython%2Fcpython.git Docs: Update SyntaxError message in REPL example for list comprehension (GH-93901) --- diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst index f847ee325e0d..f5986fe292fb 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 "", line 1, in + File "", 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]