[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-03-02 Thread Thor Whalen
Thanks Brett. I'll stay put (and hopeful) then. Thanks for all the great
work you're doing out there. Despite the (loud) dissenters, a lot of us
(silently) appreciate it.

On Thu, Feb 25, 2021 at 10:57 AM Brett Cannon  wrote:

>
>
> On Thu, Feb 25, 2021 at 8:46 AM Thor Whalen  wrote:
>
>> Finally! One of my top python wishes!
>>
>> Where can I vote?
>>
>
> There is no explicit voting, but thanks for sharing your opinion!
>
>
>>
>> How can I get my hands on a back port?
>>
>
> Probably can't since it will be new to 3.10 if the PEP gets accepted.
>
>
>>
>> How can I help getting this sooner?
>>
>
> As of right now there's nothing to do as the steering council has not even
> begun reviewing the PEP yet. If the PEP gets accepted then you can
> volunteer to help with the implementation and/or the review of the code.
>
> -Brett
>
>
>> ___
>> Python-Dev mailing list -- python-dev@python.org
>> To unsubscribe send an email to python-dev-le...@python.org
>> https://mail.python.org/mailman3/lists/python-dev.python.org/
>> Message archived at
>> https://mail.python.org/archives/list/python-dev@python.org/message/2QPAZ26E77MV2AZLDF3Z6DNHWZHQUPH5/
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/DCLYEBBRS7QMKML7LPP7DWVQKJ6GH4P6/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-26 Thread Stefano Borini
If interested, you can try it out from my github branch:

https://github.com/stefanoborini/cpython/tree/PEP-637-implementation-attempt-2

I am going to sync it against python master in a few minutes (it's
been a while, there probably will be conflicts).

Please break it.

On Thu, 25 Feb 2021 at 16:41, Thor Whalen  wrote:
>
> Finally! One of my top python wishes!
>
> Where can I vote?
>
> How can I get my hands on a back port?
>
> How can I help getting this sooner?
> ___
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-dev@python.org/message/2QPAZ26E77MV2AZLDF3Z6DNHWZHQUPH5/
> Code of Conduct: http://python.org/psf/codeofconduct/



-- 
Kind regards,

Stefano Borini
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/EEMTQCKZ7E62EYNV5S7CTLCJXBHFPBCM/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-25 Thread Brett Cannon
On Thu, Feb 25, 2021 at 8:46 AM Thor Whalen  wrote:

> Finally! One of my top python wishes!
>
> Where can I vote?
>

There is no explicit voting, but thanks for sharing your opinion!


>
> How can I get my hands on a back port?
>

Probably can't since it will be new to 3.10 if the PEP gets accepted.


>
> How can I help getting this sooner?
>

As of right now there's nothing to do as the steering council has not even
begun reviewing the PEP yet. If the PEP gets accepted then you can
volunteer to help with the implementation and/or the review of the code.

-Brett


> ___
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-dev@python.org/message/2QPAZ26E77MV2AZLDF3Z6DNHWZHQUPH5/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/HWNMML442Q72LQVPUCAYAI3BTKLN4Y2U/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-25 Thread Thor Whalen
Finally! One of my top python wishes!

Where can I vote? 

How can I get my hands on a back port?

How can I help getting this sooner? 
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/2QPAZ26E77MV2AZLDF3Z6DNHWZHQUPH5/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-06 Thread Stefano Borini
Yes. It's already supported in the branch. You can do
MyType[whatever=5]. One could possibly change dict to allow both the
specification dict[str, int] and dict[key=str, value=int], but this
specific change of the dict class is not part of the implementation
nor the PEP (nor I expect it to happen, for what matters, and I would
not request it).

On Sat, 6 Feb 2021 at 11:10, Larry Hastings  wrote:
>
>
> On 2/5/21 4:25 PM, Stefano Borini wrote:
>
> dicts and lists will keep working as before. They will not support
> keyword arguments (probably ever, as there is no clear semantic for
> them) and the current implementation simply throws an error if the
> user tries to.
>
>
> Is the plan to add PEP 637 support to type objects, so they allow 
> constructing type hints using named parameters, as suggested in the PEP?
>
>
> Thanks,
>
>
> /arry



-- 
Kind regards,

Stefano Borini
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/R2WISH5AJHNIUPVTFXFCTN7E2IIIBKHR/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-06 Thread Guido van Rossum
On Sat, Feb 6, 2021 at 03:13 Larry Hastings  wrote:

> On 2/5/21 4:25 PM, Stefano Borini wrote:
>
> dicts and lists will keep working as before. They will not support
> keyword arguments (probably ever, as there is no clear semantic for
> them) and the current implementation simply throws an error if the
> user tries to.
>
>
> Is the plan to add PEP 637 support to type objects, so they allow
> constructing type hints using named parameters, as suggested in the PEP?
>

>From time to time we have situations in the typing system where this would
be useful, and once it exists I expect we will use it

We have an immediate use for x[*y], see pep 646.

—Guido
-- 
--Guido (mobile)
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/CUULNR4DWKXN6FWKAL5EGDIPLCYQNLCH/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-06 Thread Larry Hastings


On 2/5/21 4:25 PM, Stefano Borini wrote:

dicts and lists will keep working as before. They will not support
keyword arguments (probably ever, as there is no clear semantic for
them) and the current implementation simply throws an error if the
user tries to.



Is the plan to add PEP 637 support to type objects, so they allow 
constructing type hints using named parameters, as suggested in the PEP?



Thanks,


//arry/

___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/FW2NE352IFTVRJ3TJSURQAZOLVCGQGES/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-06 Thread Stefano Borini
On Sat, 6 Feb 2021 at 08:56, Batuhan Taskaya  wrote:
>
> Lurking around the discussions I started to wonder whether this syntax
> actually worths the burden it introduces.

It has been discussed for weeks on py-ideas.

> As you have commented out
> earlier, there are no use cases in the built-in types, perhaps a
> research would be great regarding possible use cases of keyword
> arguments in and out of the stdlib.

Nor there is for the @ operator, but it is still relevant for external
libraries.

> Now looking at PEP 637, even with
> the theoretical examples given, it seems like we are introducing a
> redundant syntax that has no other value than just complicating the
> already complex subscript notation and becoming a bad alternative to
> function call syntax.

you can't do:

f(x, y=3) = 5

but you can do

a[x, y=3] = 5

pandas has relied on workarounds like iloc() to work around the lack
of an indexing operator with keyword arguments, and we need them
anyway for specifying types, now that the indexing operator is "abused
of notation" all the time for typing.

Of course the meaning of a[x, y=3] = 5 is up to the implementation of
a. We don't prescribe anything on that.

>
> On Tue, Feb 2, 2021 at 2:40 PM Stefano Borini  
> wrote:
> >
> > Hi all,
> >
> > I would like to request feedback by python-dev on the current
> > implementation of PEP 637 - Support for indexing with keyword
> > arguments.
> >
> > https://www.python.org/dev/peps/pep-0637/
> >
> > The PEP is ready for SC submission and it has a prototype
> > implementation ready, available here (note, not reviewed, but
> > apparently fully functional)
> >
> > https://github.com/python/cpython/compare/master...stefanoborini:PEP-637-implementation-attempt-2
> >
> > (note: not sure if there's a preference for the link to be to the diff
> > or to the branch, let me know if you prefer I change the PEP link)
> >
> > Thank you for your help.
> >
> >
> > --
> > Kind regards,
> >
> > Stefano Borini
> > ___
> > Python-Dev mailing list -- python-dev@python.org
> > To unsubscribe send an email to python-dev-le...@python.org
> > https://mail.python.org/mailman3/lists/python-dev.python.org/
> > Message archived at 
> > https://mail.python.org/archives/list/python-dev@python.org/message/E3AMOIB3GKYAGN6IVSLEEKVP4VUEC2V3/
> > Code of Conduct: http://python.org/psf/codeofconduct/



-- 
Kind regards,

Stefano Borini
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/MX7YSGRP25KZ2LXW3CCQDRVAEKQ3WLNM/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-06 Thread Batuhan Taskaya
Lurking around the discussions I started to wonder whether this syntax
actually worths the burden it introduces. As you have commented out
earlier, there are no use cases in the built-in types, perhaps a
research would be great regarding possible use cases of keyword
arguments in and out of the stdlib. Here is an example:
https://www.python.org/dev/peps/pep-0572/#examples-from-the-python-standard-library
that was done for PEP 572, which actually helped me a lot to
understand/comprehend the proposal.  Now looking at PEP 637, even with
the theoretical examples given, it seems like we are introducing a
redundant syntax that has no other value than just complicating the
already complex subscript notation and becoming a bad alternative to
function call syntax.

On Tue, Feb 2, 2021 at 2:40 PM Stefano Borini  wrote:
>
> Hi all,
>
> I would like to request feedback by python-dev on the current
> implementation of PEP 637 - Support for indexing with keyword
> arguments.
>
> https://www.python.org/dev/peps/pep-0637/
>
> The PEP is ready for SC submission and it has a prototype
> implementation ready, available here (note, not reviewed, but
> apparently fully functional)
>
> https://github.com/python/cpython/compare/master...stefanoborini:PEP-637-implementation-attempt-2
>
> (note: not sure if there's a preference for the link to be to the diff
> or to the branch, let me know if you prefer I change the PEP link)
>
> Thank you for your help.
>
>
> --
> Kind regards,
>
> Stefano Borini
> ___
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-dev@python.org/message/E3AMOIB3GKYAGN6IVSLEEKVP4VUEC2V3/
> Code of Conduct: http://python.org/psf/codeofconduct/
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/MO57TTSZGEBXAG2RMHEGLRO4Z72Z2GZC/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-05 Thread Stefano Borini
dicts and lists will keep working as before. They will not support
keyword arguments (probably ever, as there is no clear semantic for
them) and the current implementation simply throws an error if the
user tries to.

Other classes will take advantage of the syntax for enhanced behavior.
We are not specifying what that specific behavior might be (as in the
case of the @ operator, which is "kind of bound" to a matmul
operation, although it can be used for anything else, like / is used
as a join operator in pathlib, even though its typical meaning is a
division operator). Any class that is willing to accept keyword
arguments for the indexing operation is responsible for documenting
which arguments are accepted and what is the meaning of their use. We
do not prescribe any rule, although some uses can probably be
classified as bad practice.

On Fri, 5 Feb 2021 at 10:30, Larry Hastings  wrote:
>
>
> I missed the discussion around the PEP.  I don't mean to start another one, 
> I'd just like a clarification.  The PEP describes the new functionality, and 
> the interfaces, and that's all fine.  But I didn't see where it discussed 
> where this technology would be used.
>
> Would this mainly be used by third-party math libraries (Pandas, NumPy), like 
> the @ operator, or is there a plan to use this in Python's own library or 
> builtin objects?  If the latter, can you go into the specifics?  I'm guessing 
> the typing module would use it, as illustrated by one of the examples, but 
> beyond that I can't imagine how this would be used by e.g. dicts and lists.
>
>
> Thanks,
>
>
> /arry
>
> On 2/2/21 3:36 AM, Stefano Borini wrote:
>
> Hi all,
>
> I would like to request feedback by python-dev on the current
> implementation of PEP 637 - Support for indexing with keyword
> arguments.
>
> https://www.python.org/dev/peps/pep-0637/
>
> The PEP is ready for SC submission and it has a prototype
> implementation ready, available here (note, not reviewed, but
> apparently fully functional)
>
> https://github.com/python/cpython/compare/master...stefanoborini:PEP-637-implementation-attempt-2
>
> (note: not sure if there's a preference for the link to be to the diff
> or to the branch, let me know if you prefer I change the PEP link)
>
> Thank you for your help.
>
>
> ___
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-dev@python.org/message/TMAEJYBI7N73L64JPFODOGYD6KQY5PIH/
> Code of Conduct: http://python.org/psf/codeofconduct/



-- 
Kind regards,

Stefano Borini
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/LMAYSMML5QEEWROPEL52I43GB2DPWJMZ/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-05 Thread Larry Hastings


I missed the discussion around the PEP.  I don't mean to start another 
one, I'd just like a clarification.  The PEP describes the new 
functionality, and the interfaces, and that's all fine.  But I didn't 
see where it discussed where this technology would be used.


Would this mainly be used by third-party math libraries (Pandas, NumPy), 
like the @ operator, or is there a plan to use this in Python's own 
library or builtin objects?  If the latter, can you go into the 
specifics?  I'm guessing the typing module would use it, as illustrated 
by one of the examples, but beyond that I can't imagine how this would 
be used by e.g. dicts and lists.



Thanks,


//arry/

On 2/2/21 3:36 AM, Stefano Borini wrote:

Hi all,

I would like to request feedback by python-dev on the current
implementation of PEP 637 - Support for indexing with keyword
arguments.

https://www.python.org/dev/peps/pep-0637/

The PEP is ready for SC submission and it has a prototype
implementation ready, available here (note, not reviewed, but
apparently fully functional)

https://github.com/python/cpython/compare/master...stefanoborini:PEP-637-implementation-attempt-2

(note: not sure if there's a preference for the link to be to the diff
or to the branch, let me know if you prefer I change the PEP link)

Thank you for your help.


___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/TMAEJYBI7N73L64JPFODOGYD6KQY5PIH/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-04 Thread Guido van Rossum
We have examined every possible permutation already, I think this would be
a distraction to pursue.

On Thu, Feb 4, 2021 at 04:20 Walter Dörwald  wrote:

> On 2 Feb 2021, at 12:36, Stefano Borini wrote:
>
> Hi all,
>
> I would like to request feedback by python-dev on the current
> implementation of PEP 637 - Support for indexing with keyword
> arguments.
>
> https://www.python.org/dev/peps/pep-0637/
>
> The PEP is ready for SC submission and it has a prototype
> implementation ready, available here (note, not reviewed, but
> apparently fully functional)
>
>
> https://github.com/python/cpython/compare/master...stefanoborini:PEP-637-implementation-attempt-2
>
> (note: not sure if there's a preference for the link to be to the diff
> or to the branch, let me know if you prefer I change the PEP link)
>
> It seems to me, that what complicates the specification is the need for
> backwards compatibility. If that wasn't an issue, we could make indexing
> operations behave exactly like function calls. Handling the additional
> argument for __setitem__ could be done the same way that passing self in
> a method call is done: By passing an additional positional argument (in
> this case as the second argument after self), So:
>
>- foo[1] is type(foo).__getitem__(foo, 1)
>- foo[1, 2] is type(foo).__getitem__(foo, 1, 2)
>- foo[(1, 2)] is type(foo).__getitem__(foo, (1, 2))
>- foo[1] = 3 is type(foo).__setitem__(foo, 3, 1)
>- foo[1, 2] = 3 is type(foo).__setitem__(foo, 3, 1, 2)
>- foo[(1, 2)] = 3 is type(foo).__setitem__(foo, 3, (1, 2))
>
> But of course this isn't backwards compatible with respect to the
> treatment of tuple arguments and the argument order in __setitem__.
> However it is *much* easier to remember and to teach.
>
> The PEP rejects the idea to implement this approach via a new set of
> dunder methods (e.g. __getitem_ex__, __setitem_ex__ and __delitem_ex__)
> for performance reasons, but would it make sense, to mark existing
> __getitem__, __setitem__ and __delitem__ methods as supporting the new
> calling convention via a decorator? i.e something like:
>
> class X:
> @newstyle_item
> def __getitem__(self, x, y, z=42):
> ...
>
> @newstyle_item
> def __setitem__(self, value, x, y, z=42):
> ...
>
> @newstyle_item
> def __detitem__(self, x, y, z=42):
> ...
>
> This wouldn't require an additional dictionary lookup, but just a check of
> a bit in the function object.
>
> Thank you for your help.
>
> Servus,
> Walter
> ___
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-dev@python.org/message/DTOO36EXJRBGA7OJVTRAE7I43D2FR7BS/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-- 
--Guido (mobile)
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/EACMAG7WM25KPSNHSEGW5M4K2WL2B6MV/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-04 Thread Walter Dörwald

On 2 Feb 2021, at 12:36, Stefano Borini wrote:


Hi all,

I would like to request feedback by python-dev on the current
implementation of PEP 637 - Support for indexing with keyword
arguments.

https://www.python.org/dev/peps/pep-0637/

The PEP is ready for SC submission and it has a prototype
implementation ready, available here (note, not reviewed, but
apparently fully functional)

https://github.com/python/cpython/compare/master...stefanoborini:PEP-637-implementation-attempt-2

(note: not sure if there's a preference for the link to be to the diff
or to the branch, let me know if you prefer I change the PEP link)


It seems to me, that what complicates the specification is the need for 
backwards compatibility. If that wasn't an issue, we could make indexing 
operations behave exactly like function calls. Handling the additional 
argument for `__setitem__` could be done the same way that passing 
`self` in a method call is done: By passing an additional positional 
argument (in this case as the second argument after `self`), So:


*   `foo[1]` is `type(foo).__getitem__(foo, 1)`
*   `foo[1, 2]` is `type(foo).__getitem__(foo, 1, 2)`
*   `foo[(1, 2)]` is `type(foo).__getitem__(foo, (1, 2))`
*   `foo[1] = 3` is `type(foo).__setitem__(foo, 3, 1)`
*   `foo[1, 2] = 3` is `type(foo).__setitem__(foo, 3, 1, 2)`
*   `foo[(1, 2)] = 3` is `type(foo).__setitem__(foo, 3, (1, 2))`

But of course this isn't backwards compatible with respect to the 
treatment of tuple arguments and the argument order in `__setitem__`. 
However it is **much** easier to remember and to teach.


The PEP rejects the idea to implement this approach via a new set of 
dunder methods (e.g. `__getitem_ex__`, `__setitem_ex__` and 
`__delitem_ex__`) for performance reasons, but would it make sense, to 
mark existing `__getitem__`, `__setitem__` and `__delitem__` methods as 
supporting the new calling convention via a decorator? i.e something 
like:



```python
class X:
@newstyle_item
def __getitem__(self, x, y, z=42):
...

@newstyle_item
def __setitem__(self, value, x, y, z=42):
...

@newstyle_item
def __detitem__(self, x, y, z=42):
...
```

This wouldn't require an additional dictionary lookup, but just a check 
of a bit in the function object.



Thank you for your help.


Servus,
   Walter
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/DTOO36EXJRBGA7OJVTRAE7I43D2FR7BS/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-04 Thread Paul Moore
On Thu, 4 Feb 2021 at 10:34, Stefano Borini  wrote:
> I'd focus only on the use of the feature "from the outside", that is,
> using the indexing operation as a common user.
> For implementing the dunders, it's an advanced feature and it's
> unlikely to be discussed during basic teaching sessions.

I think there's value in having a note about how to promote "best
practices" in implementing the dunders under "How to teach". A
relevant point about the proposal is whether it's too easy for people
to fall into traps when implementing the functionality, and this is a
good section to discuss that. It should be covered by noting where in
the documentation it'll be discussed, so I don't think it's a big
deal, but it's worth having.

Paul
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/HFIK2WNDWHYXZGWVJUBHMMOYRQUSOB6R/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-04 Thread Stefano Borini
On Thu, 4 Feb 2021 at 01:21, Petr Viktorin  wrote:

> The PEP does lack a "How to teach" section.

I can add it tonight, and I think it would clarify some corner cases
to make them more natural.
Do you have something specific you are concerned about, when it comes
to "teachability" (stress point, hard to grok, expected common
mistakes)?

I'd focus only on the use of the feature "from the outside", that is,
using the indexing operation as a common user.
For implementing the dunders, it's an advanced feature and it's
unlikely to be discussed during basic teaching sessions.



-- 
Kind regards,

Stefano Borini
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/BJ5IT7T5RA6XFDZWTNIOPGLA6FSV35D2/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-03 Thread Petr Viktorin

On 2/2/21 12:36 PM, Stefano Borini wrote:

Hi all,

I would like to request feedback by python-dev on the current
implementation of PEP 637 - Support for indexing with keyword
arguments.

https://www.python.org/dev/peps/pep-0637/

The PEP is ready for SC submission and it has a prototype
implementation ready, available here (note, not reviewed, but
apparently fully functional)

https://github.com/python/cpython/compare/master...stefanoborini:PEP-637-implementation-attempt-2

(note: not sure if there's a preference for the link to be to the diff
or to the branch, let me know if you prefer I change the PEP link)

Thank you for your help.


+1 from me. This looks quite useful in certain areas and natural to use. 
I like how this makes the dunder implementations (usually libraries), 
rather than users, deal with most of the corner cases -- but still 
allows libraries that don't need this to not care.



The PEP does lack a "How to teach" section.


"Corner case 3" concludes that "best practice suggests that keyword 
subscripts should be flagged as keyword-only when possible":


def __getitem__(self, index, *, direction='north'):

If the PEP is accepted, this should be mentioned in the 
__(get|set|del)item__ documentation and shown in all relevant examples.


Looking at corner case 1, it would also be useful to nudge people to use 
positional-only arguments whenever they accept arbitrary keyword ones. 
(The same goes for function definitions, but tutorials for those are 
already written):


def __getitem__(self, index, /, **named_axes):

It would be great if what gets copied to StackOverflow is examples of 
good practices :)

___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/2CN5A7JTZUCXTP6OMPAXWH2ABOPX6SIS/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-03 Thread Paul Bryan
I like.

On Wed, 2021-02-03 at 15:48 -0800, Guido van Rossum wrote:
> Anyone? I'm +1 on this PEP as it is, and I imagine a few other core
> devs are too (Brandt, Steven). If nobody responds before the end of
> the week I think we can say that there was no disagreement and
> Stefano can submit PEP 637 to the SC.
> 
> On Tue, Feb 2, 2021 at 3:43 AM Stefano Borini
>  wrote:
> > Hi all,
> > 
> > I would like to request feedback by python-dev on the current
> > implementation of PEP 637 - Support for indexing with keyword
> > arguments.
> > 
> > https://www.python.org/dev/peps/pep-0637/
> > 
> > The PEP is ready for SC submission and it has a prototype
> > implementation ready, available here (note, not reviewed, but
> > apparently fully functional)
> > 
> >
> https://github.com/python/cpython/compare/master...stefanoborini:PEP-637-implementation-attempt-2
> > 
> > (note: not sure if there's a preference for the link to be to the
> > diff
> > or to the branch, let me know if you prefer I change the PEP link)
> > 
> > Thank you for your help.
> > 
> > 
> > -- 
> > Kind regards,
> > 
> > Stefano Borini
> > ___
> > Python-Dev mailing list -- python-dev@python.org
> > To unsubscribe send an email to python-dev-le...@python.org
> > https://mail.python.org/mailman3/lists/python-dev.python.org/
> > Message archived at
> >
> https://mail.python.org/archives/list/python-dev@python.org/message/E3AMOIB3GKYAGN6IVSLEEKVP4VUEC2V3/
> > Code of Conduct: http://python.org/psf/codeofconduct/
> 
> 
> ___
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-dev@python.org/message/67ZLIDZPKQA2BVDNSRUQUUTPO7ZB4OIE/
> Code of Conduct: http://python.org/psf/codeofconduct/

___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/SZX43KQOKBQFVKPGRZ6ZGB26ZD4BF5B5/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 637 - Support for indexing with keyword arguments: request for feedback for SC submission

2021-02-03 Thread Guido van Rossum
Anyone? I'm +1 on this PEP as it is, and I imagine a few other core devs
are too (Brandt, Steven). If nobody responds before the end of the week I
think we can say that there was no disagreement and Stefano can submit PEP
637 to the SC.

On Tue, Feb 2, 2021 at 3:43 AM Stefano Borini 
wrote:

> Hi all,
>
> I would like to request feedback by python-dev on the current
> implementation of PEP 637 - Support for indexing with keyword
> arguments.
>
> https://www.python.org/dev/peps/pep-0637/
>
> The PEP is ready for SC submission and it has a prototype
> implementation ready, available here (note, not reviewed, but
> apparently fully functional)
>
>
> https://github.com/python/cpython/compare/master...stefanoborini:PEP-637-implementation-attempt-2
>
> (note: not sure if there's a preference for the link to be to the diff
> or to the branch, let me know if you prefer I change the PEP link)
>
> Thank you for your help.
>
>
> --
> Kind regards,
>
> Stefano Borini
> ___
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-dev@python.org/message/E3AMOIB3GKYAGN6IVSLEEKVP4VUEC2V3/
> Code of Conduct: http://python.org/psf/codeofconduct/
>


-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*

___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/67ZLIDZPKQA2BVDNSRUQUUTPO7ZB4OIE/
Code of Conduct: http://python.org/psf/codeofconduct/