The Real Python Podcast

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


Listen Later

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:

    • Texas Instruments To Release New TI-84 Calculator With Python
    • spylls
    • Additional Links:

      • Episode 47: Unraveling Python’s Syntax to Its Core With Brett Cannon
      • Resource acquisition is initialization (RAII) - Wikipedia Article
      • The Social Contract of Open Source
      • import asyncio: Learn Python’s AsyncIO #1 - The Async Ecosystem – YouTube
      • David Lord’s Twitter Thread on Adding Type Annotations for Pallets Projects
      • Episode 9: Leveling Up Your Python Literacy and Finding Python Projects to Study With Cecil Phillip
      • requests: A simple, yet elegant, HTTP library
      • Python Application Layouts: A Reference – Real Python Article
      • Wily: A command-line application for tracking, reporting on complexity of Python tests and applications
      • ERPNext: Free and open source ERP
      • Kitsune: Mozilla platform that powers SuMo (support.mozilla.org)
      • Black: The uncompromising code formatter
      • The Architecture of Open Source Applications
      • The Hitchhiker’s Guide to Python: Reading Great Code
      • Episode 27: Preparing for an Interview With Python Practice Problems With Jim Anderson
      • Common Python Data Structures (Guide) – Real Python Article
      • Python Stacks, Queues, and Priority Queues in Practice – Real Python Article
      • Do You Use the Python Console and the Python Math Libraries as a Calculator?
      • I Forgot How to Spellcheck
      • hunspell
      • Level up your Python skills with our expert-led courses:

        • Records and Sets: Selecting the Ideal Data Structure
        • Stacks and Queues: Selecting the Ideal Data Structure
        • Dictionaries and Arrays: Selecting the Ideal Data Structure
        • Support the podcast & join our community of Pythonistas

          ...more
          View all episodesView all episodes
          Download on the App Store

          The Real Python PodcastBy Real Python

          • 4.7
          • 4.7
          • 4.7
          • 4.7
          • 4.7

          4.7

          136 ratings


          More shows like The Real Python Podcast

          View all
          Software Engineering Radio - the podcast for professional software developers by se-radio@computer.org

          Software Engineering Radio - the podcast for professional software developers

          272 Listeners

          The Changelog: Software Development, Open Source by Changelog Media

          The Changelog: Software Development, Open Source

          283 Listeners

          Thoughtworks Technology Podcast by Thoughtworks

          Thoughtworks Technology Podcast

          41 Listeners

          Talk Python To Me by Michael Kennedy

          Talk Python To Me

          592 Listeners

          Software Engineering Daily by Software Engineering Daily

          Software Engineering Daily

          624 Listeners

          Soft Skills Engineering by Jamison Dance and Dave Smith

          Soft Skills Engineering

          269 Listeners

          Super Data Science: ML & AI Podcast with Jon Krohn by Jon Krohn

          Super Data Science: ML & AI Podcast with Jon Krohn

          298 Listeners

          Python Bytes by Michael Kennedy and Brian Okken

          Python Bytes

          213 Listeners

          Data Engineering Podcast by Tobias Macey

          Data Engineering Podcast

          142 Listeners

          Syntax - Tasty Web Development Treats by Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers

          Syntax - Tasty Web Development Treats

          982 Listeners

          DataFramed by DataCamp

          DataFramed

          266 Listeners

          Kubernetes Podcast from Google by Abdel Sghiouar, Kaslin Fields

          Kubernetes Podcast from Google

          181 Listeners

          Practical AI by Practical AI LLC

          Practical AI

          190 Listeners

          The Stack Overflow Podcast by The Stack Overflow Podcast

          The Stack Overflow Podcast

          64 Listeners

          The Pragmatic Engineer by Gergely Orosz

          The Pragmatic Engineer

          52 Listeners