Removes the value at specified index or indices.
(self, b, inplace=False)
| 429 | return self |
| 430 | |
| 431 | def removeByIndex(self, b, inplace=False): |
| 432 | """ Removes the value at specified index or indices. """ |
| 433 | a = self if inplace else self.copy() |
| 434 | if isinstance(b, Iterable): |
| 435 | try: |
| 436 | c = 0 |
| 437 | for i in b: |
| 438 | a.pop(i - c) |
| 439 | c += 1 |
| 440 | except TypeError: |
| 441 | raise TypeError( |
| 442 | "{} object cannot be interpreted as an integer".format( |
| 443 | type(i).__name__ |
| 444 | ) |
| 445 | ) from None |
| 446 | else: |
| 447 | try: |
| 448 | a.pop(b) |
| 449 | except TypeError: |
| 450 | raise TypeError( |
| 451 | "{} object cannot be interpreted as an integer".format( |
| 452 | type(b).__name__ |
| 453 | ) |
| 454 | ) from None |
| 455 | return a |
| 456 | |
| 457 | def removeByIndex_(self, b): |
| 458 | """ Removes the value at specified index or indices in-place. """ |