Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Spread operator like d = [a, b, *c] #8450

@michalpokusa

Description

@michalpokusa

CircuitPython version

Adafruit CircuitPython 8.2.4 on 2023-08-22; Adafruit Feather ESP32-S2 TFT with ESP32S2
Board ID:adafruit_feather_esp32s2_tft

Code/REPL

numbers = [1, 2, 3]
new_numbers = [0, *numbers, 4]
print(new_numbers)
# Expected output: [0, 1, 2, 3, 4]

Behavior

Traceback (most recent call last):
File "", line 1, in
SyntaxError: *numbers must be assignment target

Description

Different behaviour between CircuitPython and Python.

I do not know wheter this is intended.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions