Allowing missing item or attributes in operator’s itemgetter and attrgetter

Hello!

I opened an equally-named thread in the “Ideas section” and it got some traction.

The base idea is provide a default keyword-only option to attrgetter and itemgetter (if the item or attribute are not present that default would be returned).

As it was well received, I want to push it forward, but I’m here to ask for advice: is it “big enough” to worth a PEP or I should just open an issue for this behaviour? (note it has some discussions, some alternatives, and I’d want to reflect those).

Thanks!

1 Like

A PEP is a great way to record those discussions and alternatives, and will save people looking them up in the future.

If it’s an uncontroversial idea, then it should be an easy process. But it will draw enough attention that it will probably be at least a little bit controversial :wink:

5 Likes