Set a flag on the function or a global?

Ethan Furman ethan at stoneleaf.us
Mon Jun 15 20:19:59 EDT 2015


On 06/15/2015 04:57 PM, Steven D'Aprano wrote:

> Thoughts and feedback? Please vote: a module global, or a flag on the
> object? Please give reasons, and remember that the function is intended
> for interactive use.

Function attribute.

Setting a global on the module (which I may not have, and probably didn't, import) for only one function is overkill.

   edir.dunders = False # or True

is simple, elegant, easier to type, and perfectly in keeping with Python's dynamic nature.

--
~Ethan~



More information about the Python-list mailing list