Just taking a ride on the thread here,

I made a quick talk on the proposed feature for a local group,
and in the process I refactored a "real world" class I have in a 
project, which features a complicated __init__ due having lots
 of different, optional, ways to be initialized.

I can tell I liked what could be done  - 
reducing roughly 60 loc packed with "isinstance" calls,
"if/elif" blocks, temporary, intermediate state variables,
into 25 lines including 10 case-clauses that are very
straightforward to read. 

Sorry for whoever would like an example differing much of the 
"point2d" examples  on the PEP, but the class in question IS geometry related
and is a Rectangle -


I am not yet testing (neither on the 'normal' if/else version)
_invalid_ arguments - there are a lot of way to pass
conflicting arguments to __init__  - and the if/elif logic
to handle those properly is not in place. The match/case
version for handling these invalid combinations would be
very straight forwad, on the other hand  .

(all said, I think I still miss a way to mark variables that
are assigned in the case clauses, just for the record :-)  )

Enough cheaptalk - links are here:

tests:
https://github.com/jsbueno/terminedia/blob/fa5ac012a7b93a2abe26ff6ca41dbd5f5449cb0b/tests/test_utils.py#L356

Branch comparison for the match/case version:
https://github.com/jsbueno/terminedia/compare/patma

You will notice one "real world" pattern that was needed there: as the case clauses had
to be aware of values spread across different keyword-parameters, I had to prepend
a "packing" of all function arguments into a mapping to match against. 

If I would not care for the function signature, I could just get "**kwargs" and match against that. 



On Thu, 6 Aug 2020 at 14:09, Brett Cannon <brett@python.org> wrote:


On Thu, Aug 6, 2020 at 3:46 AM Mark Shannon <mark@hotpy.org> wrote:
Hi Barry,

How long do we have to present objections to PEP 622?

We haven't discussed a timeline among ourselves yet (unless it was discussed at the last meeting which missed 😁).
 

I don't feel that the PEP gives adequate prominence to the objections so
far raised, and there are more issues I would like to bring up.

I don't think we would want to keep pushing out every time someone has more to say as that would mean this would never end. 😉 But I doubt we will be making a decision next week, so if you can get any comments in between now and the 17th you will probably get it in before the earliest we will very optimistically make a decision.

-Brett
 

Cheers,
Mark.


On 05/08/2020 5:58 pm, Barry Warsaw wrote:
> PEP 622 is already on the SC’s agenda for review.
>
> -Barry
>
>> On Aug 5, 2020, at 09:47, Ethan Furman <ethan@stoneleaf.us> wrote:
>>
>> On 7/30/20 8:35 AM, Rob Cliffe via Python-Dev wrote:
>>
>>> The debate is still going on as to whether "capture" variables should be marked...
>> I don't think the PEP authors are debating it any more.  Quite frankly, I wish they would present to the SC and get accepted so we can get Pattern Matching added to 3.10.  :)
>>
>> --
>> ~Ethan~
>> _______________________________________________
>> Python-Dev mailing list -- python-dev@python.org
>> To unsubscribe send an email to python-dev-leave@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/PGEVEI2W7L32FFCLFOWGFRANMBZHPILQ/
>> Code of Conduct: http://python.org/psf/codeofconduct/
>
>
> _______________________________________________
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-leave@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/CVYGPSODOHTLEGPRM4EI5GTMR6PHSZLF/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/OSDBFZRZFJVSZ5ZBJ6QFRPWEGL2FJCJZ/
Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/ESAKYRYV6L6ZMMXO4NTMYOD6OBSOBRQO/
Code of Conduct: http://python.org/psf/codeofconduct/