[Pandas-dev] Colon available everywhere
Pietro Battiston
me at pietrobattiston.it
Thu Jul 19 16:27:08 EDT 2018
Il giorno gio, 19/07/2018 alle 09.33 -0700, Stephan Hoyer ha scritto:
> I'm pretty sure this has been proposed before on Python-ideas.
> Definitely search through the archives first.
The closest I found is
https://mail.python.org/pipermail/python-ideas/2015-June/034086.html
https://bugs.python.org/issue24379
proposing the less invasive (not requiring changes in the language),
but also less useful
slice.literal
as in
reverse = slice.literal[::-1]
By the way, if only slice was subclassable, we could do
class PowerSlice(slice):
def __getitem__(self, key):
return key
W = PowerSlice()
so that both
series.df[W, 'col']
and
series.df[W[:], 'col']
would work.
Unfortunately that is not the case (and anyway, this solution would
still be suboptimal).
Pietro
More information about the Pandas-dev
mailing list