<div dir="ltr">Il giorno ven 7 lug 2023 alle ore 05:32 Charles <<a href="mailto:peacech@gmail.com">peacech@gmail.com</a>> ha scritto:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif;font-size:small">If you are going to put the Icon class in a module why don't just use module level __getattr__?</div></div></blockquote></div><div><br></div><div>While that's possible, it would only be feasible (and safe) whenever the module is strictly used for that specific purpose, otherwise there could be inconsistency due to other objects that may share an identical name.</div><div><br></div><div>Since __getattr__ opens to the possibility of *any* name, it prevents the possibility of wildcard imports (which, while normally discouraged, are not forbidden), or having a multiple purpose module that includes the Icon class, which could be a problem whenever the module also contains another class that could theoretically match a "guessed" name.<br><br></div><div>I chose to use the basic concept of a standalone class as a semantic context for generic usage.</div><div>If you want to make it a __getattr__ enabled module, you can just add that support using the same logic.<br></div><div><br></div><div>Best regards,<br></div><div>MaurizioB<br></div></div>