-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Open
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
The proposal if for these functions to receive a default
argument.
The main motivation is operator.attrgetter
, which implements nested attribute access, but is missing getattr
's default value support. operator.itemgetter
also gets the default
argument for consistency.
For operator.attrgetter
, only AttributeError
s should be suppressed, and for operator.itemgetter
, KeyError
.
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
tomasr8
Metadata
Metadata
Assignees
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement