Python Functions: Introduction to the Series

As a beginner to Python programming, we learn how to call simple built-in functions. Indeed, the famous “Hello World” program in Python boils down to a single function call, so one could argue it’s the first thing we learn to do:

print("Hello, world!")

As our skills improve, learning to not only call functions but how to write them. Writing clear, useful, and maintainable functions is a skill that separates beginner Python programmers from senior engineers.

Because this is such a large and important topic, we’ve decided to collect and better organize the articles we’ve written. We thought the topics could benefit from better navigation, so you can quickly look up the Python function topic of interest to you. That effort is currently underway, and we’ll add to the navigation bar on the left we slice and dice the material to prepare you a more tasty meal.

A Draft Outline

The following is an initial outline of headers on topics that will appear soon. If you want to know when these topics are available, we recommend signing up for our newsletter.

[sibwp_form id=3]

  • What is a function?

  • Math functions vs. programming functions

  • Calling functions

  • How Do I Call This Function: Getting Help

  • Return values

  • Writing your first functions

  • Python “main function”

  • Beginner function exercises

    • Solutions

  • Returning multiple values

  • Default return value

  • Documenting functions

    • Docstrings

    • Type Hints

  • Function arguments and function parameters

  • Functions vs. Methods

  • Function Best Practices

  • Keyword parameters and positional parameters

  • Default Parameters

    • Basics

    • Gotchas

  • Positional Only Parameters

  • Keyword-Only Parameters

  • Variable Parameters: *args and **kwargs

  • Functions are first-class objects

  • Python Lambda Functions