What Can You Do With Python and Counting Objects Using "Counter"

56:56
 
Chia sẻ
 

Manage episode 298157438 series 2637014
Thông tin tác giả Real Python được phát hiện bởi Player FM và cộng đồng của chúng tôi - bản quyền thuộc sở hữu của nhà sản xuất (publisher), không thuộc về Player FM, và audio được phát trực tiếp từ máy chủ của họ. Bạn chỉ cần nhấn nút Theo dõi (Subscribe) để nhận thông tin cập nhật từ Player FM, hoặc dán URL feed vào các ứng dụng podcast khác.

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.

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.

interactive-coding-challenges: 120+ Interactive Python Coding Interview Challenges With Anki Flashcards

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:

Additional Links:

Support the podcast & join our community of Pythonistas

80 tập