A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://realpython.com/lessons/kwargs-in-function-definitions/ below:

Using the Python kwargs Variable in Function Definitions (Video) – Real Python

The examples show how one might access the keys OR the values of the dictionary, but that leaves the question of why one would pass a dictionary as a whole rather than just keys or values. Have you a good example of how having each map item as a whole is uniquely useful within a function?

@Zarata - Keyword arguments are dictionaries because you associate a name with a value. Here is the description of keyword arguments from the official documentation - keyword argument: an argument preceded by an identifier (e.g. name=) in a function call or passed as a value in a dictionary preceded by *.*

You will have to pass the whole dictionary to the function because keys and values alone are technically meaningless unless used together.

Become a Member to join the conversation.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4