Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MicroPython doesn't support alternative syntax to create a tuple outta comprehension #1957

Open
3 tasks done
GoToLoop opened this issue Jan 29, 2024 · 1 comment
Open
3 tasks done
Labels
3rd party Errors coming from foreign projects we either enable or rely on needs-triage Issue needs triage type: bug Something isn't working

Comments

@GoToLoop
Copy link

GoToLoop commented Jan 29, 2024

Checklist

  • I added a descriptive title
  • I searched for other issues and couldn't find a solution or duplication
  • I already searched in Google and didn't find any good information or help

What happened?

In the file "mpy.py" @ setup() I'm creating a tuple from a generator comprehension:
balls = tuple( Ball(p) for _ in BALLS )
https://PyScript.com/@gotoloop/bouncing-colorful-balls

However if I change that to balls = *( Ball(p) for _ in BALLS ), it fails on μPython:
https://PyScript.com/@gotoloop/bouncing-colorful-balls/v4

SyntaxError: *x must be assignment target

But if I swap it to Pyodide in "mpy.html" it works as expected w/ that alt. syntax:
<script type=py src=mpy.py config=mpy.toml></script>
https://PyScript.com/@gotoloop/bouncing-colorful-balls/v5

Of course it's not a big deal; but it saves 3 characters to fit everything in 80 cols.

What browsers are you seeing the problem on? (if applicable)

Firefox, Chrome, Other

Console info

MicroPython exception: Traceback (most recent call last):
  File "<stdin>", line 73, in setup
SyntaxError: *x must be assignment target

convert_mp_to_js_obj_jsside @ micropython.mjs:5532

Additional Context

No response

@GoToLoop GoToLoop added needs-triage Issue needs triage type: bug Something isn't working labels Jan 29, 2024
@WebReflection
Copy link
Contributor

WebReflection commented Jan 29, 2024

I think this bug would better be in MicroPython repository using the WebAssembly/PyScript - prefix as we're not working on MicroPython in here.

@WebReflection WebReflection added the 3rd party Errors coming from foreign projects we either enable or rely on label Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party Errors coming from foreign projects we either enable or rely on needs-triage Issue needs triage type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants