[Python-Dev] Simpler reformulation of C inheritance Q.
06 Aug 2002 12:06:45 +0100
Christian Tismer <email@example.com> writes:
> Hi Guido:
> here a simpler formulation of my question:
> I would like to create types with overridable methods.
> This is supported by the new type system.
> But I'd also like to make this as fast as possible and
> therefore to avoid extra dictionary lookups for methods,
> especially if they are most likely not overridden.
I would wonder how much this saves.
How many more instructions does
? Sure, *some* but not all that many esp. if the called function is
actually doing significant work.
Of course, the first gets you a PyCFunctionObject* (or similar) not a
function pointer and that adds a layer of overhead. In fact, this is
probably the greater source of overhead (you might have to box up the
arguments, allocate & deallocate the argument tuple, etc).
I doubt my opinion counts here, but I think I'd prefer to see *less*,
not more, methods in type object in future. Particularly if there's
some way to call functions with known signatures efficiently.
Unfortunately, that seems pretty hard after five minutes thinking.
I wouldn't trust the Anglo-Saxons for much anything else. Given
they way English is spelled, who could trust them on _anything_ that
had to do with writing things down, anyway?
-- Erik Naggum, comp.lang.lisp