Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Array splice function similar to JavaScript's...
- def splice(ar, i, d, a*):
- """ Inject values into an array, optionally dropping some at the insertion point
- ar = the array to manipulate
- i = where to inject
- d = how many to drop at injection point
- ... remaining args: what to inject
- """
- r = ar[0:i]
- r.extend(a)
- r.extend(ar[i + d:])
- return r
Add Comment
Please, Sign In to add comment