How To Profile Python Code

Python is a programming language that has gained massive popularity — but this popularity stems from its readability and ease of use rather than raw performance. Because of this, it can sometimes be even more critical to optimize for performance in Python than in other languages. Profiling is a tool that can help developers accomplish … Read more

Python JSON: Easily Work With Dictionaries, Files, and Custom Objects

JSON (JavaScript Object Notation) is perhaps the most popular data-interchange format. Python has a built-in JSON package that lets you conveniently and quickly encode and decode JSON to and from Python dictionaries, which share a similar key/value structure but are much easier to manipulate in Python. This tutorial will show you how to work with … Read more

Python Dictionaries for Beginners: A Complete Lesson With Exercises

Python dictionaries are a popular and easy-to-use built-in type. Among the collection data types — the types programmers use to store and retrieve other objects — dictionaries are probably the most widely used class next to Python lists. Using Python dictionaries is simple to learn, but mastering them and remembering the syntax when you need … Read more

Useful Collection Classes in Python You May Not Know

Most Python developers know about dictionaries, lists, and tuples — three workhorse collections that are so useful that they repeatedly appear in Python code. Compared to other languages, these essential collections have such excellent support in the language that they feel almost like native types. For example, they all have special constructors and operators unique … Read more

Python Generators: The Complete Guide

Python Logo

Many Python developers consider generators an advanced topic because they are less well known than sequence types such as lists, arrays, and strings. Also, because the syntax for generator functions can appear strange at first, many developers don’t take the time to learn about them at all. That’s a shame, really, because, in some instances, … Read more