In Python we have "list.extend(otherlist)" as a multi-item "append" basic function.
I found that this is a bit tedious in hyperscript (or of course I might be missing something). Especially if I'm parsing something where the result could be a non-list (which is also interesting in its own from a typing perspective that splitting an empty string results in a non-list):
<span data-assignees="a b c"
_="init
set $assignees to my @data-assignees split by ' '
if not $assignees then set $assignees to []" />
I wish I could do this instead:
<span data-assignees="a b c"
_="init
set $assignees to []
extend $assignees with my @data-assignees split by ' '
" />
We could also consider whether "split by" should always return a list (I'm not quite sure what's going on there when @data-assignees is an empty value) but that's orthogonal to the extend ability.
In Python we have "list.extend(otherlist)" as a multi-item "append" basic function.
I found that this is a bit tedious in hyperscript (or of course I might be missing something). Especially if I'm parsing something where the result could be a non-list (which is also interesting in its own from a typing perspective that splitting an empty string results in a non-list):
I wish I could do this instead:
We could also consider whether "split by" should always return a list (I'm not quite sure what's going on there when
@data-assigneesis an empty value) but that's orthogonal to the extend ability.