MacMusic  |  PcMusic  |  440 Software  |  440 Forums  |  440TV  |  Zicos
attribute
Search

[$] Altering Python attribute handling for modules

Wednesday September 6, 2023. 09:29 PM , from LWN.net
A recent discussion on the Python forum looked at a way to
protect module objects (and users) from mistaken attribute assignment and
deletion.
There are ways
to get the same effect today, but the mechanism that would be used causes a
performance penalty for an unrelated, and heavily used, action: attribute
lookup on modules. Back in 2017, PEP 562 ('Module __getattr__
and __dir__') set the stage for adding magic methods to module objects; now
a new proposal would extend that idea to add __setattr__() and
__delattr__() to them.
https://lwn.net/Articles/943619/
News copyright owned by their original publishers | Copyright © 2004 - 2024 Zicos / 440Network
Current Date
May, Fri 10 - 04:03 CEST