[Grok-dev] questions about the Martian code

Martijn Faassen faassen at startifact.com
Wed Dec 17 07:58:32 EST 2008

Brandon Craig Rhodes wrote:
> I am learning more about martian so that I can write good docstrings for
> Grok's own meta.py, and had two quick questions about martian's
> components.py:
>  - I cannot quite see the reason for the ComponentGrokkerBase class.  It
>    would seem simpler for the ClassGrokker and InstanceGrokker to just
>    inherit directly from GrokkerBase, and each declare separately that
>    they implement IComponentGrokker.

It indeed seems to be a useless class. See whether you can remove it and 
have the tests still work?

>  - Should GlobalGrokker be named ModuleGrokker instead, since that seems
>    to be the sort of object for which its grok() method will be called?

We already have a ModuleGrokker. :) ModuleGrokker groks Python modules. 
A GlobalGrokker groks the globals *in* a module. You can have more than 
one GlobalGrokkers registered at the same time in the same 
ModuleGrokker. Each might pick up on different globals in the module.

It's a subtle distinction indeed. core.txt has a bit more on this.



More information about the Grok-dev mailing list