[Python-Dev] Idea for a fast calling convention

Paul Prescod paul at prescod.net
Mon Mar 1 23:14:40 EST 2004


Michael Hudson wrote:

>...
> 
> Well, yes.  C sucks seriously for things like this, though.  It's
> frankly embarassing that *every* time, say, ''.split() is called, some
> silly string is being parsed.  Unclear what to do about this (excpet
> PyPy, I guess).

Or Pyrex.

Obviously either PyPy or Pyrex takes quite a bit of code rewriting. Fun 
rewriting but rewriting nevertheless. If we're going to require 
rewriting isn't there a more short-term way to simply eliminate the 
requirement to use PyArgParseTuple in most cases?

If functions declared their type signatures in a new-fangled PyMethodDef 
then Python could optimize away common cases at module-initialization or 
type-initialization time. I don't understand why we usually (as opposed 
to occasionally) want to declare our type signature only when the 
function is run rather than earlier when the runtime could do useful 
stuff with it.

Putting aside performance for a second: introspection on C functions is 
pretty weak for the same reason.

  Paul Prescod





More information about the Python-Dev mailing list