You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "/home/gringo/accessia/main/controller_start/test.py", line 9
with Test() as *mambo:
^^^^^^
SyntaxError: starred assignment target must be in a list or tuple
withTest() as (*mambo,):
print(mambo, type(mambo))
does give [1, 2] <class 'list'>, as does with Test() as [*mambo]:. I'm not a grammar expert, but I believe there are some places where the tuple is implicit so that "*" target is valid and other places where the ()/[] are required to be explicitly added. I'm not sure whether/how the documentation can be improved here.
Activity
HLLRay commentedon Jun 17, 2025
zware commentedon Jun 17, 2025
does give
[1, 2] <class 'list'>, as doeswith Test() as [*mambo]:. I'm not a grammar expert, but I believe there are some places where the tuple is implicit so that"*" targetis valid and other places where the()/[]are required to be explicitly added. I'm not sure whether/how the documentation can be improved here.iritkatriel commentedon Jun 20, 2025
We can do this:
What would be the purpose/expected behaviour of
with Test() as *mambo:?