Closed steph1111 closed 4 months ago
Update after talking to Mike:
match
statements in python are not the same as a switch
statement in C, C++, Java, etc. A switch
statement checks for equality where as a match
statement's primary function is pattern matching. Although their syntax look similar and in some cases they have the same functionality, a match
statement is not a switch
statement. This is why the code above fails, it should instead be written in the if
, elif
, elif
format (even though its gross :sob: )
In the terminal widget, I am trying to emulate some of the more common terminal shortcuts (
ctrl-a
,ctrl-u
, etc) and thus need to determine if the key sequence pressed is one of these options. I would like this to be a match statement of the form:But this fails with the following errors. See
commit b103449
for code.However if I write it in the form:
This works with no issues. See
commit 4dd329b
for code.