Episode 70: What Can You Do With Python and Counting Objects Using "Counter"
The Real Python Podcast
Jul 23, 2021 56m
How is Python being used today, and what can you do with the language? Do you want to develop software, dive into data science and math, automate parts of your job and digital life, or work with electronics? This week on the show, David Amos is back, and he’s brought another batch of PyCoder’s Weekly articles and projects.
Episode Sponsor:
We talk about a Real Python article that covers the incredible variety of ways you can use Python. David shares an article about the pythonic way to count objects using the Counter class from the collections module. We discuss the ways it can lead to cleaner and more efficient code.
We cover several other articles and projects from the Python community including, the inaugural CPython developer-in-residence, typeclasses in Python, GitHub Copilot writes a text-based game, friendlier tracebacks in REPLs (including Jupyter), 120+ interactive interview challenges, a module that helps you build complex pipelines of batch jobs, and a tool for plotting in the terminal.
Course Spotlight: Understanding Python List Comprehensions
Python list comprehensions make it easy to create lists while performing sophisticated filtering, mapping, and conditional logic on their members. In this course, you’ll learn when to use a list comprehension in Python and how to create them effectively.
Topics:
- 00:00:00 – Introduction
- 00:02:01 – Łukasz Langa Is the Inaugural CPython Developer-in-Residence
- 00:05:03 – What Can I Do With Python?
- 00:11:19 – Typeclasses in Python
- 00:17:59 – Sponsor: Sentry
- 00:19:01 – Copilot Writes a Text-Based Game in Python
- 00:27:31 – Python’s Counter: The Pythonic Way to Count Objects
- 00:34:14 – interactive-coding-challenges: 120+ Interactive Python Coding Interview Challenges With Anki Flashcards
- 00:38:11 – Video Course Spotlight
- 00:39:11 – Friendlier Tracebacks in REPLs (Including Jupyter)
- 00:49:37 – luigi: Python Module That Helps You Build Complex Pipelines of Batch Jobs
- 00:52:13 – plotext: Plotting in the Terminal
- 00:55:24 – Thanks and goodbye
Show Links:
Łukasz Langa Is the Inaugural CPython Developer-in-Residence
What Can I Do With Python? – You’ve finished a course or finally made it to the end of a book that teaches you the basics of programming with Python. You’ve learned about variables, lists, tuples, dictionaries, for and while loops, conditional statements, object-oriented concepts, and more. So, what’s next? What can you do with Python nowadays?
Typeclasses in Python – Sometimes you need to change the behavior of a function based on the type of argument passed to it. This is a classic example of polymorphism in programming. In this article, you’ll learn how this is typically done in Python, compare that to polymorphism in other languages, and see how the new classes library can make the whole process easier.
Copilot Writes a Text-Based Game in Python – GitHub’s new Copilot feature has a lot of people talking. The project’s goal is to be an AI pair programmer — a tool that can suggest entire lines of code or even entire functions! In this amusing article, one developer who gained access to Copilot’s technical preview shares how the AI wrote an entire text-based adventure game that turned out to be the solution to an exercise from a Python instructional book.
Python’s Counter: The Pythonic Way to Count Objects– In this step-by-step tutorial, you’ll learn how to use Python’s Counter
to count several repeated objects at once. You’ll also learn how to use Counter
objects to enhance other computations that you do in Python.
Friendlier Tracebacks in REPLs (Including Jupyter) – Tracebacks are often the start of any Python debugging journey. But tracebacks can be difficult to read and confusing to beginners. The friendly-traceback project aims to lift the veil of confusion for tracebacks by providing more helpful error messages with lots of context. New updates to the project include better tracebacks in Jupyter Notebooks!
Projects:
- luigi: Python Module That Helps You Build Complex Pipelines of Batch Jobs
- plotext: Plotting in the Terminal
Additional Links:
- I am the new CPython Developer in Residence: Łukasz Langa
- Python Success Stories: python.org
- Using FastAPI to Build Python Web APIs: Real Python Article
- GitHub Copilot
- GitHub Copilot: Fly With Python at the Speed of Thought
- Anki: Powerful, Intelligent Flash Cards
- friendly-traceback
- Status of PEP657 in Python 3.11 by Pablo Galindo
- Episode 69: Planning a Faster Future at the Python Language Summit
- Metaflow: A Framework for Real-life Data Science
- Lessons from a real Machine Learning project, part 1: from Jupyter to Luigi
- Data pipelines, Luigi, Airflow: everything you need to know