def Slice(*args, **kwargs): # pylint: disable=invalid-name
"""A block which applies Python slicing to a PyObject, Tuple, or Sequence.
For example, to reverse a sequence:
```python
(Map(Scalar()) >> Slice(step=-1)).eval(range(5)) => [4, 3, 2, 1, 0]
Positional arguments are not accepted in order to avoid the ambiguity of slice(start=N) vs. slice(stop=N).
Args:
*args: Positional arguments; must be empty (see above).
**kwargs: Keyword arguments; start=None, stop=None, step=None, name=None
.
Returns: The block. """ if args: raise TypeError('Slice does not accept positional arguments; allowed ' 'keyword arguments are start, stop, and step') name = kwargs.pop('name', None) return GetItem(_get_slice(**kwargs), name=name).set_constructor_name( 'td.Slice') ```