Selecting the Ideal Data Structure & Unravelling Python's "pass" and "with"

48:48
 
Chia sẻ
 

Manage episode 293579425 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 do you know you’re using the correct data structure for your Python project? There are so many built into Python and even more that are importable from the collections module. This week on the show, David Amos is back, and he’s brought another batch of PyCoder’s Weekly articles and projects. We discuss a recent three-part video course on selecting the ideal data structure.

Along with comparing the types of dictionaries, data records, arrays, stacks, and more, David covers a recent Real Python article about the namedtuple. This deep dive covers how to use the namedtuple to write cleaner code.

We also discuss new articles from previous guest Brett Cannon. He has added two posts to his Python syntactic sugar series about unravelling the pass and with statement.

We cover several other articles and projects from the Python community including, async in Flask 2.0, Python projects on Github that are examples of best practices and good architecture, how SpaceX sort of lands starship, the new ti-84 calculator with Python, and building a Python spell checker.

Spotlight: Stacks and Queues: Selecting the Ideal Data Structure

In this course, you’ll learn about three of Python’s data structures: stacks, queue and priority queues. You’ll look at multiple types and classes for all of these and learn which implementations are best for your specific use cases.

Topics:

  • 00:00:00 – Introduction
  • 00:02:06 – Write Pythonic and Clean Code With namedtuple
  • 00:05:38 – Unravelling the pass Statement
  • 00:10:31 – Unravelling the with statement
  • 00:13:38 – Async in Flask 2.0
  • 00:19:04 – Sponsor: Digital Ocean’s App Platform
  • 00:19:40 – Python Projects on Github That Are Examples of Best Practices and Good Architecture
  • 00:26:43 – How SpaceX Lands Starship (Sort Of)
  • 00:32:00 – Stacks and Queues: Selecting the Ideal Data Structure
  • 00:38:34 – Video Course Spotlight
  • 00:40:39 – Texas Instruments To Release New TI-84 Calculator With Python
  • 00:44:23 – spylls: Python spell checker
  • 00:47:36 – Thanks and goodbye

Show Links:

Write Pythonic and Clean Code With namedtuple – In this step-by-step tutorial, you’ll learn what Python’s namedtuple is and how to use it in your code. You’ll also learn about the main differences between named tuples and other data structures, such as dictionaries, data classes, and typed named tuples.

Unravelling the pass Statement – When you need to indicate that a bit of code intentionally does nothing, then you need to reach for Python’s pass statement. In the latest installment of Brett’s “Syntactic Sugar” series, you’ll learn how pass works, when to use it, and why it’s a uniquely Python concept.

Unravelling the with statement

Async in Flask 2.0 – This article looks at Flask 2.0’s new async functionality and how to leverage it in your Flask projects. You’ll learn how Flask processes requests asynchronously using a traditional WSGI server, instead of the ASGI server used by many other async web frameworks. You’ll also learn how to simulate Flask 2.0 async in Flask 1.X applications.

Python Projects on Github That Are Examples of Best Practices and Good Architecture – This Reddit thread is full of GitHub repos that might make for some good code reading.

How SpaceX Lands Starship (Sort Of) – While waiting for SN15 to launch, Thomas Goddard set out to pull together a 2-dimensional simulation of the Starship landing. Tying together knowledge of trajectory optimization, Thomas modeled the landing in Python with the CasADI library and used Matplotlib to generate an animation which, when played side-by-side with the footage of the landing, results in remarkable similarity to the actual landing dynamics.

Stacks and Queues: Selecting the Ideal Data Structure – Learn about three of Python’s data structures: stacks, queue and priority queues. You’ll look at multiple types and classes for all of these and learn which implementations are best for your specific use cases.

Projects:

Additional Links:

Support the podcast & join our community of Pythonistas

71 tập