Firstly, congratulation on PEP 634, I just want to suggest an enhancement for the "match" statement.
- When the matching against cases of pattern, there are some situations when there is no match.
- Using a cluster of "else" make it more readable compared with using a wildcard case.
- It's likewise in cases of the "if", "for", "try" statements, when conditions are not matching or when elements in a collection are not found, having the cluster of "else" in the above-mentioned statements make the code syntaxial readable to express what the Python program should.
For example , taken from PEP 636 , instead of :
matchcommand.split():
case ["go", direction] ifdirectionincurrent_room.exits:
current_room=current_room.neighbor(direction)
case ["go", _]:
print("Sorry, you can't go that way")the programmer have express a possible situation as :
matchcommand.split():
case ["go", direction] ifdirectionincurrent_room.exits:
current_room=current_room.neighbor(direction)
case ["go", _]:
print("Sorry, you can't go that way")
else : print( f"Sorry, I don't understand what you mean by {command}.")I hope you got my point.
Firstly, congratulation on PEP 634, I just want to suggest an enhancement for the "match" statement.
For example , taken from PEP 636 , instead of :
the programmer have express a possible situation as :
I hope you got my point.