Skip to content

Commit dd5dd18

Browse files
committed
optimize: don't autocurry Values(...) calls
1 parent f713a3f commit dd5dd18

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

unpythonic/syntax/autocurry.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ def transform(self, tree):
8585
return tree
8686

8787
hascurry = self.state.hascurry
88-
if type(tree) is Call:
88+
# Curry all calls; except as a small optimization, skip `Values(...)`,
89+
# which accepts any args and kwargs, so currying it does not make sense.
90+
# (It represents multiple-return-values in `unpythonic`.)
91+
if type(tree) is Call and not isx(tree.func, "Values"):
8992
if has_curry(tree): # detect decorated lambda with manual curry
9093
# the lambda inside the curry(...) is the next Lambda node we will descend into.
9194
hascurry = True

0 commit comments

Comments
 (0)