Chris Angelico wrote:
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.
Most classes in builtins won't let you monkeypatch them anyway, so I'm not sure it's worth the bother of trying to protect against that.