Arthur
Arthur

Reputation: 3473

What does this Python expression mean?

Please advice, what does this expression return?

localized_title = lambda **_: localization._create_localized_string(0xB30B3A74)

What value will be stored in localized_title and what does

lambda **_:

mean?

Upvotes: 1

Views: 55

Answers (1)

dhke
dhke

Reputation: 15388

**_ is a kwargs glob. Any keyword arguments passed to the lambda will be stored in the dictionary _.

_ is probably used a placeholder variable name, since the lambda expression doesn't use the arguments for anything.

localized_title will contain the lambda, i.e. a functional expression that can be called with arbitrary keyword arguments (which will be ignored) and which will return the return value of localization._create_localized_string(0xB30B3A74) at the time the lambda is invoked.

So localized_title is basically a wrapper around localization._create_localized_string(0xB30B3A74) that ignores all keyword arguments.

Upvotes: 8

Related Questions