PEP 726: Module __setattr__ and __delattr__

A tangentially related side note: the steering council just rejected PEP 713 to add __call__ to modules. Our main reason being not enough compelling evidence of seemingly important practical uses for the feature. That bar seems like what I’d expect us to want an answer to for this PEP as well. __getattr__ and __dir__ had specific benefits.

The current 726 text has a Motivation section that covers what one could do with it. But the thing I personally think is currently missing are specific use cases for why it’d be useful. ex: What problems are package or module maintainers having today that would be improved by having this in the future?

Things like your later comment about using the __class__ module attribute to do similar things should be included in the PEP in an Alternatives Considered or Existing Options style section.

3 Likes