The Real Python Podcast

Python Return Statement Best Practices and Working With the map() Function


Listen Later

The Python return statement is such a fundamental part of writing functions. Is it possible you missed some best practices when writing your own return statements? This week on the show, David Amos returns with another batch of PyCoder’s Weekly articles and projects. We also talk functional programming again with an article on the Python map function and processing iterables without a loop.

We cover several other articles and projects from the Python community including, interactive data visualization with Pygal, everything you need to know about namedtuples, PEP 638 syntactic macros, python for kids, the new Nvidia Jetson board, and a reinforcement learning project named football.

Topics:

  • 00:00:00 – Introduction
  • 00:01:33 – Interactive Data Visualization in Python With Pygal
  • 00:06:40 – Python’s map(): Processing Iterables Without a Loop
  • 00:12:51 – Everything You Need to Know About Python’s NamedTuples
  • 00:19:46 – PEP 638: Syntactic Macros
  • 00:26:43 – Video Course Spotlight
  • 00:27:57 – The Python return Statement: Usage and Best Practices
  • 00:34:42 – Python for Kids
  • 00:38:03 – Build a Face Recognition System With the Nvidia Jetson Nano
  • 00:42:32 – football: Reinforcement Learning Environment
  • 00:45:51 – Thanks and goodbye
  • Show Links:

    Interactive Data Visualization in Python With Pygal – Pygal is an overlooked library for creating interactive plots that can be turned into SVGs with an optimal resolution for printing or displaying on webpages. Learn how it works in this introductory tutorial.

    Python’s map(): Processing Iterables Without a Loop – In this step-by-step tutorial, you’ll learn how Python’s map() works and how to use it effectively in your programs. You’ll also learn how to use list comprehension and generator expressions to replace map() in a Pythonic and efficient way.

    Everything You Need to Know About Python’s NamedTuples – Are you using NamedTuple in your code? If you aren’t, learn what they are and why you should consider using them in this comprehensive tutorial.

    PEP 638: Syntactic Macros – This brand new PEP, which is still in draft mode, proposes adding support for syntactic macros to Python. Syntactic macros are compile-time functions that extend the language’s syntax without adding any new complexity to the language as a whole.

    The Python return Statement: Usage and Best Practices – In this step-by-step tutorial, you’ll learn how to use the Python return statement when writing functions. Additionally, you’ll cover some good programming practices related to the use of return. With this knowledge, you’ll be able to write readable, robust, and maintainable functions in Python.

    Python for Kids – In this ten part series, senior software engineer Kevin Thomas presents a kid-friendly comprehensive Python development tutorial utilizing a micro:bit development board. The GitHub repo contains all of the sample code as well as links to each tutorial in the series on LinkedIn. The first seven parts are published and the last three are coming soon!

    Projects:

    Build a Face Recognition System With the Nvidia Jetson Nano 2GB and Python – The Nvidia Jetson Nano is a single board computer similar to a Raspberry Pi. The Jetson Nano really packs a punch, however, thanks to its onboard Nvidia Maxwell GPU.

    football: Reinforcement Learning Environment Where Agents Learn to Play Football

    Additional Links:

    • Pygal: Sexy python charting
    • Bokeh: Interactive visualization library
    • Common Python Data Structures (Guide) - Real Python article
    • The Ultimate Guide to Data Classes in Python 3.7 - Real Python article
    • PEP 572 – Assignment Expressions - Walrus Operator
    • Python’s reduce(): From Functional to Pythonic Style - Real Python article
    • NVIDIA Jetson Nano
    • Google Research Football with Manchester City F.C.
    • Level up your Python skills with our expert-led courses:

      • Command Line Interfaces in Python
      • Exploring Basic Data Types in Python
      • Defining Main Functions in Python
      • 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