On Sat, Sep 09, 2017 at 02:33:18PM -0700, Victor Stinner
I was able to find a real keyboard, so here is a more complete code: --- class Noop: def __call__(self, *args, **kw): return self def __enter__(self, *args, **kw): return self def __exit__(self, *args): return def __repr__(self): return 'nope' ---
Example: --- noop = Noop() print(noop) print(noop()) with noop() as nope: print(nope) with noop as well: print(well) ---
Output: --- nope nope nope nope ---
IHMO the real question is if we need a Noop.nope() method?
Yep. It must return self so one can chain as many calls as she wants.
Victor
Oleg. -- Oleg Broytman http://phdru.name/ phd@phdru.name Programmers don't die, they just GOSUB without RETURN.