Assign to a slice of a Python list from a lambda
Posted
by
Bushman
on Stack Overflow
See other posts from Stack Overflow
or by Bushman
Published on 2011-02-20T23:22:32Z
Indexed on
2011/02/20
23:25 UTC
Read the original article
Hit count: 256
I know that there are certain "special" methods of various objects that represent operations that would normally be performed with operators (i.e. int.__add__
for +, object.__eq__
for ==, etc.), and that one of them is list.__setitem
, which can assign a value to a list element. However, I need a function that can assign a list into a slice of another list.
Basically, I'm looking for the expression equivalent of some_list[2:4] = [2, 3]
.
© Stack Overflow or respective owner