Python Forum
parenthesis around a tuple of literals in a for
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
parenthesis around a tuple of literals in a for
#1
is parenthesis required around a tuple of literals in a for?

i'm running into this:

Output:
>>> for x in 1,2,3: ... print(x) ... 1 2 3 >>> [x for x in 1,2,3] File "<stdin>", line 1 [x for x in 1,2,3] ^ SyntaxError: invalid syntax >>>
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
parenthesis around a tuple of literals in a for - by Skaperen - Aug-24-2019, 11:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Why does Python not use parenthesis to contain loops? davidorlow 3 5,624 Jun-09-2021, 06:33 AM
Last Post: Gribouillis
  replace in code vs literals Skaperen 3 3,510 Mar-30-2021, 12:37 AM
Last Post: Skaperen
  code with no tuple gets : IndexError: tuple index out of range Aggam 4 4,663 Nov-04-2020, 11:26 AM
Last Post: Aggam
  What Are Python Literals? Julie 11 7,367 Sep-23-2020, 05:31 PM
Last Post: Gribouillis
  string literals in a list. Not what I expected. tycarac 3 3,608 Dec-28-2019, 05:31 AM
Last Post: tycarac
  Parenthesis in User-Defined Functions giorgitsu 2 2,718 Aug-07-2019, 12:56 PM
Last Post: ThomasL
  How to get first line of a tuple and the third item in its tuple. Need Help, Anybody? SukhmeetSingh 5 4,531 May-21-2019, 11:39 AM
Last Post: avorane
  a Word Inside Parenthesis in Class Decleration tahasozgen 2 3,305 Dec-18-2018, 05:59 AM
Last Post: Gribouillis
  Escaping whitespace and parenthesis in filenames jehoshua 2 12,007 Mar-21-2018, 09:12 AM
Last Post: jehoshua

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020