I thought of the use of `.__getitem__()` in metaclasses in the typing
module. I feel like this use is more natural and more useful than that.
Should we someday need a slice generic type for PEP 484, the spelling would
naturally be `Slice[T]` instead, in my mind. But `slice[1:10,2]` should be
a constructor for a concrete slice object.
On Sat, Nov 12, 2016 at 11:20 AM, אלעזר
On Sat, Nov 12, 2016 at 9:10 PM David Mertz
wrote: dfmi.loc[slice[:,:,['C1','C3']], slice[:,'foo']]
I like the change proposed to `str(slice(10))` also... and it would be way better if `slice[:10]` were actual "syntax." In fact, in that case it could even be the repr().
Indexing operator for classes already has a meaning, for generic types. It is a possibility that slice will become a generic type (see here: https://github.com/python/mypy/issues/2410#issuecomment-258898836) and this syntax will make it either impossible or require Slice[] to be different from slice[] in a potentially confusing way.
Elazar
-- Keeping medicines from the bloodstreams of the sick; food from the bellies of the hungry; books from the hands of the uneducated; technology from the underdeveloped; and putting advocates of freedom in prisons. Intellectual property is to the 21st century what the slave trade was to the 16th.