(In Python) Can't assign to a range of a tab's layers

I have a script where i am replacing (editing, programmatically) the selected glyphs.

It would be nice if i could use Python’s range assignment to do it like this:

tab.layers[tab.textCursor:tab.textCursor+tab.textRange] = replacements

but that doesn’t work because apparently __setitem__ isn’t implemented.

Any chance this could work in the future?

I’ll have a look. Until then, get the layers, change the list and assign the full list.

Yes, i’ve replaced the code with:

tab.layers = (
    tab.layers[: tab.textCursor]
    + replacements
    + tab.layers[tab.textCursor + tab.textRange :]
)

which isn’t too bad actually.