[Python-Dev] Re: More informative error messages

Guido van Rossum guido at python.org
Wed Oct 8 09:47:07 EDT 2003


> At the time the TypeError is constructed it shouldn't add serious
> overhead to check if its a method or a function and subtract 1
> accordingly.

You'd think so, eh?  Have you looked at the code?  Have you tried to
come up with a patch?  Why do you think that in 13 years this hasn't
been fixed if it's such a common complaint?

I'm not arguing against fixing this (I think it would be great) but
the number of people who've implied that this should be an easy thing
to fix annoys me.

For better or for worse, the distinction between a function and a
bound method is gone by the time it's called, and recovering that
difference is going to be tough.  Not in terms of serious overhead,
but in terms of serious changes to code that is already extremely
subtle.  That code it's so subtle *because* we want to keep function
call overhead as low as possible, and anything that would add even a
fraction of a microsecond to the cost of calling a function with the
correct number of arguments will be scrutinized to death.

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list