[issue44276] Replace if-elif-else structure with match-case (PEP634)

2021-06-04 Thread Kshitiz Arya
Kshitiz Arya added the comment: As Brandt shows us, match-case in its current implementation is not significantly different from an if-else ladder in term of performance, though I still maintain that match-case is much more readable than an if-else ladder. I also agree with Karthikeyan

[issue44283] Add jump table for certain safe match-case statements

2021-06-02 Thread Kshitiz Arya
Change by Kshitiz Arya : -- nosy: +Kshitiz17 ___ Python tracker <https://bugs.python.org/issue44283> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44276] Replace if-elif-else structure with match-case (PEP634)

2021-06-02 Thread Kshitiz Arya
Kshitiz Arya added the comment: I have used timeit module. I have also attached the test file with this message -- Added file: https://bugs.python.org/file50081/match_test.py ___ Python tracker <https://bugs.python.org/issue44

[issue44276] Replace if-elif-else structure with match-case (PEP634)

2021-06-02 Thread Kshitiz Arya
Kshitiz Arya added the comment: I have timed the execution of if-else and match-case on Differ().compare from difflib module and here is what I got When both strings are same ** if-else

[issue44276] Replace if-elif-else structure with match-case (PEP634)

2021-06-01 Thread Kshitiz Arya
Kshitiz Arya added the comment: I guess we will have to wait until Python 3.10 is released and we have more conclusive data about speed and readability of match-case before we can go ahead with this issue. -- ___ Python tracker <ht

[issue44276] Replace if-elif-else structure with match-case (PEP634)

2021-06-01 Thread Kshitiz Arya
Kshitiz Arya added the comment: This is a relatively simple example of how this will improve readability of the code. (This example is form Lib/json/encoder.py) Original - if isinstance(value, str): yield

[issue44276] Replace if-elif-else structure with match-case (PEP634)

2021-06-01 Thread Kshitiz Arya
Kshitiz Arya added the comment: Pardon my ignorance here but can I start working on this issue? I am a new contributor therefore I am unsure about how to proceed from here -- ___ Python tracker <https://bugs.python.org/issue44

[issue44276] Replace if-elif-else structure with match-case (PEP634)

2021-05-31 Thread Kshitiz Arya
New submission from Kshitiz Arya : Replace if-elif-else with match-case for pattern matching, which is generally faster and more intuitive. -- components: Library (Lib) messages: 394839 nosy: Kshitiz17 priority: normal severity: normal status: open title: Replace if-elif-else