Loading topic
*args 5 min readNone), and can read a short traceback. It covers how Python matches the arguments in a call to the parameters in a definition. Later chapters build on this matching with 5 min readNone), and can read a simple traceback. It also assumes you have seen default values such as def f(x=1) and keyword calls such as f(x=2).5 min readdef is a statement that runs, and can read a simple traceback. It also assumes you know how to give a parameter a default value. The rule here is when that default value gets computed. Many default-argument surprises follow from that5 min readNone behave, and can read a simple traceback. It also assumes you know that a default value lets a caller leave an argument out. Here you will see why that feature gives surprising results when the default is a list 5 min readdef runs, and have seen the mutable default bug from the previous chapters. Here you will fix that bug and learn where the fix goes wrong.5 min read* in a def line forces callers to pass some parameters by name, and when that is worth doing.5 min readTypeError traceback. It also assumes you know the * marker for keyword-only parameters. Positional-only parameters are the mirror image of those. They are written with / and need Pyt4 min read* and / markers. You should also be comfortable with tuples and dicts.4 min read*args and **kwargs do in a def. Here you will use * and ** on the calling side, where they spread a collection into separate arguments.5 min read*) and positional-only (/) parameters, *args, **kwargs, and argument unpacking. Here you use that knowledge to read the TypeError messages Pyth5 min read*), positional-only parameters (/), an4 min read*, /, *args, and **kwargs behave. It also assumes you know why items=[] is a bug. The earlier chapters explained how Python binds arguments. This chapter is about the choices you make5 min read