[Grok-dev] Re: Grok in Zope 2: Paris Sprint first day wrap up:
faassen at startifact.com
Sat Apr 26 11:29:54 EDT 2008
Brandon Craig Rhodes wrote:
> "Lennart Regebro" <regebro at gmail.com> writes:
>> from ExtensionClass import ExtensionClass
>> except ImportError:
>> ExtensionClass = types.ClassType
>> and then change a line in MultiGrokker.grokkers from
>> if obj_type in (type, types.ClassType):
>> if obj_type in (type, types.ClassType, ExtensionClass):
> This strikes me as ugly and, in its admittedly small way, confusing
> and inefficient:
> (a) ExtensionClass will be pulled in merely because it exists, not
> because the user is actually trying to use it in this app.
> (b) If ExtensionClass does not exist, then the symbol becomes
> available anyway but means something quite different from what
> it says.
> (c) If ExtensionClass is not available, you wind up comparing the
> obj_type against the same value *twice*.
Yeah, I hadn't thought about these points, but these are indeed
drawbacks. I think (b) and (c) are the worst.
Looks like a reasonable improvement. I don't we care much about
efficiency here (whether your improvement would improve efficiency would
need to be benchmarked, but that's a waste of time), but the clarity
arguments I'll buy.
I think Brandon sketched out a better approach, guys. :)
More information about the Grok-dev