Fwd: Re: PEP 472 - slices in keyword indices, d[x=1:3]
I attempted to send this yesterday, but used the wrong sender email address and it got rejected. I think this is still relevent, just to confirm I understand the proposal correctly. ----- Forwarded message from Steven D'Aprano <steve+python@pearwood.info> ----- Date: Mon, 24 Aug 2020 11:46:02 +1000 From: Steven D'Aprano <steve+python@pearwood.info> To: python-ideas@python.org Subject: Re: [Python-ideas] PEP 472 - slices in keyword indices, d[x=1:3] On Sun, Aug 23, 2020 at 09:40:53PM -0400, Todd wrote:
I think it is worth directly discussing the availability of slices in PEP 472-style keyword indices, since we seem to have mostly converged on a dunder method signature. This is an issue that has been alluded to regarding keyword-based (labelled) indices but not directly addressed. The basic syntax would be something like d[x=1:3].
I read that as equivalent to `d[x=slice(1, 3)]`. Is that your intention? If that is your intention, then a big +1. If your intention was `d[slice(x=1, 3)]` then I think you would have to justify what it means and why you want it. -- Steven ----- End forwarded message -----
On Tue, Aug 25, 2020, 05:10 Steven D'Aprano <steve@pearwood.info> wrote:
I attempted to send this yesterday, but used the wrong sender email address and it got rejected.
I think this is still relevent, just to confirm I understand the proposal correctly.
----- Forwarded message from Steven D'Aprano <steve+python@pearwood.info> -----
Date: Mon, 24 Aug 2020 11:46:02 +1000 From: Steven D'Aprano <steve+python@pearwood.info> To: python-ideas@python.org Subject: Re: [Python-ideas] PEP 472 - slices in keyword indices, d[x=1:3]
On Sun, Aug 23, 2020 at 09:40:53PM -0400, Todd wrote:
I think it is worth directly discussing the availability of slices in PEP 472-style keyword indices, since we seem to have mostly converged on a dunder method signature. This is an issue that has been alluded to regarding keyword-based (labelled) indices but not directly addressed. The basic syntax would be something like d[x=1:3].
I read that as equivalent to `d[x=slice(1, 3)]`. Is that your intention?
If that is your intention, then a big +1.
Yes, this was my intention. The same as with current slices, just passed to the keyword argument.
participants (2)
-
Steven D'Aprano
-
Todd