[$] Altering Python attribute handling for modules
A recent discussion on the Python forum looked at a way toprotect module objects (and users) from mistaken attribute assignment anddeletion. There are ways to get the same effect today, but the mechanism that would be used causes aperformance penalty for an unrelated, and heavily used, action: attributelookup on modules. Back in2017, PEP562 ("Module __getattr__and __dir__") set the stage for adding magic methods to module objects; nowa new proposal would extend that idea to add __setattr__() and__delattr__() to them.