On Nov 12, 2016 5:46 PM, "David Mertz" email@example.com wrote:
If we *do* want the name 'slice' as the spelling for the thing that can
either be called or indexed to create a slice object, we could probably use some boilerplate like this:
In : class Slice: ...: def __init__(self): ...: self.slice = slice ...: def __getitem__(self, x): ...: return x ...: def __call__(self, *args, **kws): ...: return self.slice(*args, **kws) ...:
In : slice = Slice()
In : slice(1,10,2) Out: slice(1, 10, 2)
In : slice[1:10:2] Out: slice(1, 10, 2)
I'm sure there are some less common uses of the name 'slice' that would
break here. That's why I'd want an official standard behavior.
isinstance(obj, slice) would be a notable one.