Just about every day of every week, I teach Python. I teach not only in Israel, but also in Europe, China, and the US. While I do teach newcomers to programming, the overwhelming majority of my students are experienced developers in another language — most often C, C++, Java, or C#.
For many of these people, I find that it’s hard to keep track of which data structure does what — when do you use lists vs. dicts vs. tuples vs. sets. Moreover, it’s hard for them to remember the most common methods and operators we use on these data structures.
Perhaps the most common question I get is, “How do I add a new element to a dictionary?” They’re often looking for an “append” method, and are surprised to find that one doesn’t exist.
That, and other questions, led me to create this “cheat sheet for Python data structures.” It’s not meant to be all-encompassing, but rather to provide some insights and reminders into the most common tasks you’ll want to do with lists, tuples, dicts, and sets.
My students have found this to be helpful — and I hope that it’ll be useful to other Python developers out there, as well! Feedback is, of course, warmly welcome.
The post Free download: Cheat sheet for Python data structures appeared first on Lerner Consulting Blog.