Tutorials
Programming
Programming tutorials for people who want code that actually runs, not code that only looks right. Pick a language, start at the beginning, and don't skip the basics. They are where most problems come from.
0 likes
Likes for this tutorial.
Python Dictionary Comprehensions: When They Help and When They Hurt
Level: Intermediate
A dictionary comprehension builds a dictionary in one line. Good for transforming, filtering and building lookups. Bad for nested logic, side effects and anything that needs error handling. Shorter code is not always better code.
5 min read
0 likes
Likes for this tutorial.
Python if __name__ == "__main__": What It Does and When You Need It
Level: Intermediate
Importing a file runs it. if __name__ == "__main__" keeps a file's script part from running when another file imports it. Use it with a main() function, and know the cases where you don't need it.
4 min read