[Python-Dev] Exceptions

Paul Prescod paul@prescod.net
Thu, 13 Jul 2000 03:01:24 -0500

Greg Stein wrote:
> If you're going to create a PyStringObject for the format and one for the
> argument, then pass it to PyString_Format, then toast those temporaries...
> then you're going about it wrong. :-)

You're right. It's too late...

Anyhow, this whole process seems wrong. Shouldn't the exceptions know
what their appropriate error messages are and take the arguments for
their format strings as arguments? There shouldn't be duplicated error
messages spread throughout the code. It's brutal for consistency. You
probably discussed this six months ago also.

Anyhow, I think that that's the answer to Fredrik's (implicit) question
about how decide when to make new exceptions. If it requires a new
docstring or message string/format then it should be a new exception. We
had relatively few exceptions before because they were just strings. Now
that they are objects we should expect them to proliferate as they tend
to in other languages where objects are exceptions. 

We should start tightening up the parameters we expect them to take for
their constructors too.
 Paul Prescod - Not encumbered by corporate consensus
Simplicity does not precede complexity, but follows it. 
	- http://www.cs.yale.edu/~perlis-alan/quotes.html