We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

krizzo • 2 weeks ago

The statement of 'Dictionaries are Python's answer to Switch Statements.' is incorrect a dict is known in other languages as a hash, map, or named list. In python 3.10 they are introducing the match/case functionality which is identical to a switch/case. Before that time if/else was the main comparing function. I once had a professional programmer state "You can go your whole career not using a break statement". Switch/Cases weren't needed due to the if/else providing the same functionality. Though I've done some testing and match/case is faster than if/else in 98-99% of all tests I've done with python. So the processing code is more optimized from what I could tell with out actually looking at the interpreter and it's ASM code.

a-Rye • 2 weeks ago

I would say that statement is more my interpretation of coding languages. I learned Java for my first language and we spent a decent amount of time learning switch statements. Later, when I learned Python for Cyber Security, my professor said as much: "Python doesn't use switch statements. Dictionaries are Python's answer to switch statements." Although, I admit that hash tables, maps, and now named lists are all on my own list for topics to explore further with this playground. I also need to finish the Sorting Algorithms section, as well as add more advanced Data Structures like Graphs. Thank you for the input! 11.2k views and just the one comment. I'm always happy to learn more and make no claim to be a pro =).