-
-
Notifications
You must be signed in to change notification settings - Fork 188
Closed
Labels
Description
Bug description
The parser has trouble understanding multi-line chained methods when being wrapped in parenthesis:
class Thing:
def do_a(self):
print("A")
return self
def do_b(self):
print("B")
return self
def do_c(self):
print("C")
return self
(Thing()
.do_a()
.do_b()
.do_c())Traceback (most recent call last):
File "main.py", line 19
.do_a()
SyntaxError: expected ')', got '.'
Which is valid in standard Python, and is a technique often used in these cases.
A workaround for this is to use newlines instead, which works both in pocketpy and standard Python (but feels less ergonomic)
Thing() \
.do_a() \
.do_b() \
.do_c()Steps to reproduce
You can run the snippet in latest online pocketpy (2025-08-31).
Also tested natively in the latest commit (1ab1750) on macOS (arm64).
Reactions are currently unavailable