Friday 10:50 a.m.–11:20 a.m.
How to Be More Effective with Functions
- Audience level:
- Best Practices & Patterns
Functions improve readability, encourage reuse, and facilitate refactoring. Python has many unique features that make functions significantly more powerful. This talk will show you the best ways to use functions in Python: when *args is helpful and when it'll crash your programs; how to use generators for arguments and return values; the value of keyword vs. keyword-only arguments; and more!
You may have learned Python's advanced syntax for functions (like `*args` and `**kwargs`), but the best time to use it may still not be obvious. The goal of this talk is to provide clear advice on how and when to use the Python language features that affect functions (and methods). This talk will present a number of concrete suggestions for how to use functions effectively. With each suggestion I'll use code examples to demonstrate why this is the best choice and why other approaches aren't a good idea.