[Grok-dev] manuel plugin for Martian's FakeModule?

Paul Wilson paulalexwilson at gmail.com
Thu Oct 22 09:25:45 EDT 2009

2009/10/22 Leonardo Rochael Almeida <leorochael at gmail.com>:
> That's really impressive, I'd say it's much better to type a whole
> module like this than in a standard doctest. Reindenting code is much
> easier than adding ">>> " to it. And to top it off no need to bother
> with the weird looking class faking as module thing.


> My next question was going to be why didn't you reuse any of the
> Martian code for fake modules, but by looking at your code it seems
> there wasn't much to reuse anyway, right?

If by 'reuse' you mean directly reuse (via import), then I think this
is intended to be a separate standalone replacement for the
fake_import and FakeModule stuff.

If you mean reuse the code/logic, then I have actually used quite a
bit of fake_import. However, currently I don't know how 'exec' in
'dict' handles the exec'd code's context. If it's smart enough to set
all the function objects up with the correct __module__ values etc,
then I don't think we need to use much more of what's in fake_import.
I'll know when I write more tests.

Hope that answers your question.

More information about the Grok-dev mailing list