I glanced at [link|http://snaga.org/pgsql/cvsweb.cgi/~checkout~/pgsql/src/pl/plperl/plperl.c?rev=1.1.1.1&content-type=text/plain|http://snaga.org/pgs...t-type=text/plain] and [link|http://snaga.org/pgsql/cvsweb.cgi/~checkout~/pgsql/src/pl/plpython/plpython.c?rev=1.1.1.2&content-type=text/plain|http://snaga.org/pgs...t-type=text/plain] to see what you are talking about. What leapt out at me is that the Python source did a lot of explicit declaring and manipulating of Python stuff. What I next noticed is that the Perl version used some big macros from the Perl source.

Take a look at and compare PLy_procedure_create to plperl_create_sub. See things like ENTER, SAVETMPS, PUSHMARK(SP), XPUSHs(sv_2mortal(newSVpv(s, 0))) and so on? Those are all macros which are commonly used within the Perl source. Those macros do a lot of stuff, and expanded out would be many more lines. It doesn't surprise me that the Python version of that function is over twice the length of the Perl version - the Perl version is going to be bigger than the Python version after you run the preprocessor over it.

Whether or not the number of macros that you have in Perl sourcecode is a good or bad thing is open to debate. (There is a reason that they did that, there are also lots of complaints about it from anyone who has to work with them.) But they certainly do leave you with less code and more confidence that certain kinds of checks have been done reliably.

Cheers,
Ben