# 部分置き換え(slice代入)

# Python

items[1:3] = ['BC'] # a,b,c,d,e => a,BC,d,e
items[2:5] = [234]
items[2:3] = [2, 3, 4]
items[2:2] = [2, 3, 4]

# これは意味が違う
items[2] = [2, 3, 4]

# Ruby

items[1..2] = ['BC'] # a,b,c,d,e => a,BC,d,e

[ 📩 ご意見 ]