#Error implementing functools function

1 messages · Page 1 of 1 (latest)

last kraken
#

G'day!

I'm trying to implement the functools.partial() function. A fellow on another server suggested this simplified implementation:

# Dale's suggestion
def partial(f, *args):
    return lambda *extra: f(*args, *extra)

# Testing it out
def multiply(x, y):
    print(x * y)

multiply_by_two = partial(multiply, 2)
multiply_by_two(6)

However, I get this error:

code.py output:
Traceback (most recent call last):
  File "code.py", line 2, in <lambda>
SyntaxError: can't have multiple *x

This works fine on my desktop with python 3.8.10.

CircuitPython reports this as my version:

Adafruit CircuitPython 7.2.0 on 2022-02-24; Pimoroni Keybow 2040 with rp2040

Any advice as to what's going wrong here?

loud lava
#

hi, yeah some things are not supported for various reasons