what is D's idiom of Python's list.extend(another_list)?

mw mingwu at gmail.com
Mon Jun 21 06:16:15 UTC 2021


On Monday, 21 June 2021 at 06:04:56 UTC, Mike Parker wrote:
> On Monday, 21 June 2021 at 05:36:36 UTC, mw wrote:
>> i.e append an array of elements into another array:
>>
>>
>> ```Python
>> x = [1, 2, 3]
>> x.extend([4, 5])
>> print(x)  # [1, 2, 3, 4, 5]
>> ```
>>
>> Thanks.
>
> ```d
> x ~= [4, 5];
> ```


Ha! great. I didn't know `~` works for both single elements and 
array!


More information about the Digitalmars-d-learn mailing list