On Wed, Sep 14, 2016 at 9:35 AM, Greg Ewing <greg.ew...@canterbury.ac.nz> wrote: > Chris Angelico wrote: > >> It's a little bit magical, in that it looks up the original class >> using globals(); > > > The way you've written it, monkeypatch() will only work > if you call it from the module it's defined in.
Yes. You could tweak that by looking at cls.__module__ and grab it from sys.modules, but I kept the example simple. However, I would NOT use the standard name lookup mechanism. ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/