a, b = [10, 20]
a, b, *rest = [10, 20, 30, 40, 50]
Personally, I prefer the Python syntax although we need to consider whether we would use * or ... for unpacking or for "automatic dependencies" in external function calls e.g. r(...) or r(*)
Rationale is primarily cleaner syntax, similar to the Python PEP rationale. In particular, I was thinking about the syntax for importing functions in Mini (e.g. reusing functions in someone else's project). This would be a function (instead of a keyword!) import e.g.
custom_plot = import('some_project/custom_plot')
But if I wanted to import several functions from a project, I'd like to write something like:
A potentially useful addition to the Mini syntax is "unpacking"/"destructuring" assignment.
Javascript has object and array "destructuring" e.g.
Python has "iterable unpacking"
Personally, I prefer the Python syntax although we need to consider whether we would use
*
or...
for unpacking or for "automatic dependencies" in external function calls e.g.r(...)
or r(*)
Rationale is primarily cleaner syntax, similar to the Python PEP rationale. In particular, I was thinking about the syntax for importing functions in Mini (e.g. reusing functions in someone else's project). This would be a function (instead of a keyword!)
import
e.g.But if I wanted to import several functions from a project, I'd like to write something like: