The Real Python Podcast

Defining Optional Arguments and Moving Beyond "Beginner" Python


Listen Later

How do you define Python functions that accept optional arguments or default values? Are you wondering how to go beyond being a beginner with Python? This week on the show, Christopher Trudeau is here, and he’s brought another batch of PyCoder’s Weekly articles and projects.

Christopher shares a Real Python article, “Defining Python Functions With Optional Arguments.” We talk about function flexibility, specifying default values, and using args & kwargs.

We discuss resources for a Python beginner to move beyond the basics and become more competent. Both of us share our experiences moving past these hurdles.

We cover several other articles and projects from the Python community, including a news roundup, ten tools you may have wished you knew when you started working with Python, Python’s zipfile for manipulating your zip files efficiently, how one company optimized Python API server code by 100x, a dependency-free Python library for downloading YouTube videos, and how to use Python on the command line with other shell commands.

Course Spotlight: Defining Python Functions With Optional Arguments

In this video course, you’ll learn about Python optional arguments and how to define functions with default values. You’ll also learn how to create functions that accept any number of arguments using args and kwargs.

Topics:

  • 00:00:00 – Introduction
  • 00:03:08 – Django Project Reformats Entire Codebase With Black
  • 00:03:53 – PEP 673: Self Type Was Accepted
  • 00:05:16 – PEP 654 Accepted: Exception Groups
  • 00:07:45 – Upcoming Python Feature PEPs
  • 00:10:01 – Defining Python Functions With Optional Arguments
  • 00:15:12 – Sponsor: CData Software
  • 00:15:53 – 10 Tools I Wish I Knew When I Started Working With Python
  • 00:23:22 – How We Optimized Python API Server Code 100x
  • 00:29:47 – Python’s zipfile: Manipulate Your ZIP Files Efficiently
  • 00:32:47 – Video Course Spotlight
  • 00:33:59 – How Do I Go From Being a Beginner to Competent in Python?
  • 00:47:02 – pytube: Dependency-Free Python Library for Downloading – YouTube Videos
  • 00:49:30 – pz: Use Python on the Command Line With Other Shell Commands
  • 00:52:23 – Thanks and goodbye
  • News:

    • Django Project Reformats Entire Codebase With Black – Related discussion on Hacker News.
    • PEP 673: Self Type Was Accepted – This PEP introduces a simple and intuitive way to annotate methods that return an instance of their class. This behaves the same as the TypeVar-based approach specified in PEP 484 but is more concise and easier to follow. Related Twitter thread by core dev Raymond Hettinger.
    • PEP 654 Accepted: Exception Groups – New standard for grouping exceptions together
    • Upcoming Python Feature PEPs – “These PEPs are a great way of getting the freshest info about what might be included in the upcoming Python releases. So, in this article we will go over all the proposals that are going to bring some exciting new Python features in a near future!”
    • Topics:

      • Defining Python Functions With Optional Arguments – Learn about Python optional arguments and how to define functions with default values. You’ll also see how to create functions that accept any number of arguments using *args and **kwargs.
      • 10 Tools I Wish I Knew When I Started Working With Python – Learn about how venvs, flake8, black, isort, pytest, commitizen, semantic-release, pre-commit hooks, and Github Actions work together!
      • How We Optimized Python API Server Code 100x – Tricks we used to speed up calls to our analytical API written in Python: asyncio, SQLAlchemy, asyncpg, Cython plugins, improved data structures, and replaced some Pandas with NumPy.
      • Python’s zipfile: Manipulate Your ZIP Files Efficiently – In this guided tutorial, you’ll learn how to manipulate ZIP files using Python’s zipfile module from the standard library. Through hands-on examples, you’ll learn how to read, write, compress, and extract files from your ZIP files quickly.
      • How Do I Go From Being a Beginner to Competent in Python?
      • Projects:

        • pytube: Dependency-Free Python Library for Downloading YouTube Videos
        • pz: Use Python on the Command Line With Other Shell Commands
        • Additional Links:

          • Fluent Python, 2nd Edition
          • Python Distilled
          • Intermediate to Advanced resources - Python resources for everybody
          • The Flask Mega-Tutorial Part I: Hello, World!
          • Level up your Python skills with our expert-led courses:

            • Defining Python Functions With Optional Arguments
            • Defining and Calling Python Functions
            • Writing Beautiful Pythonic Code With PEP 8
            • 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

              189 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