Set a flag on the function or a global?
Paul Rubin
no.email at nospam.invalid
Mon Jun 15 20:37:33 EDT 2015
Steven D'Aprano <steve+comp.lang.python at pearwood.info> writes:
> 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.
Both are bad. More state to remember, ugh. Instead have separate entry
points for filtering or not filtering the dunders. Something like:
edir(obj) = no dunders
edir_(obj) = dunders.
If you also support the keyword arg, then you could have
edir_(obj)=functools.partial(edir,dunders=True).
More information about the Python-list
mailing list