Passing information between modules

Thomas Passin list1 at tompassin.net
Mon Nov 21 00:53:40 EST 2022


On 11/21/2022 12:24 AM, dn wrote:
>> My original question probably was intended to be something
>>    like: "Today, we can add attributes to a module from the
>>    outside. How large is the risk that this will be forbidden
>>    one day, so that all code using this will stop working?".

This can happen today if, for example, a class is changed to use slots 
for everything.  Between slots and type checking, it can become 
impossible to add an arbitrary attribute.  *You* may be able to avoid 
this, but if you use someone else's modules or classes it could happen 
at any time.

I might regret the loss of being able to assign an arbitrary attribute 
wherever I like, but for complex libraries, it is probably a good idea 
in the long run.



More information about the Python-list mailing list