On 11/13/2020 1:48 PM, Joao S. O. Bueno wrote:


On Fri, 13 Nov 2020 at 17:36, Jim J. Jewett <jimjjewett@gmail.com> wrote:
I *hope* this was a typo!  If

    case Point(x=a, y=b):

assigns to a and b (instead of x and y, as in a normal call), then that is ... going to be very easy for me to forget, and to miss even when I'm aware of it.

No typo -  this is _precisely_what the main proposal on PEPs 634, 635 and 636 is suggesting, and tha PEP 642 is trying to avoid.

And the claim is, that there are people that think this is a good idea❓❓ And are actually proposing to add it to Python❓

Here it is working as is  on my Python with PEP 622 build:

```
Python 3.10.0a0 (heads/patma:1ba56a003b, Aug  6 2020, 02:00:58)  
Type 'copyright', 'credits' or 'license' for more information
IPython 7.17.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from dataclasses import dataclass                                                                                                               

In [2]: @dataclass  
  ...: class Point:  
  ...:     x: float  
  ...:     y: float  
  ...:                                                                                                                                                 

In [3]: def get_coords(p):  
  ...:     match p:  
  ...:         case Point(x=a, y=b):  
  ...:             return a, b  
  ...:         case _:  
  ...:             raise TypeError()  
  ...:                                                                                                                                                 

In [4]: get_coords(Point(3, 4))                                                                                                                         
Out[4]: (3, 4)

```

 

-jJ