[Python-Dev] Two design questions

Guido van Rossum guido at python.org
Mon Mar 19 20:38:46 CET 2007


On 3/19/07, Georg Brandl <g.brandl at gmx.net> wrote:
> I'd like to have opinions on two issues:
>
> Patch #1682205: suggests to remove code that catches a TypeError and raises one
> with a different message if it occurs during iterable unpacking. This can mask
> completely unrelated TypeErrors, while the message in the case that the new
> error describes is already clear enough.

In Py3k, this sounds like a perfect use case for exception chaining
per PEP 344 (assuming the entire chain of frames is printed). Until
then, I agree that raising another exception masking someting as
generic as TypeError is a practice that ought to be limited as much as
possible.

> Bug #1683368: object.__new__ rejects arguments if self.__class__.__init__ is
> object.__init__. Why not simply let object.__init__ do the argument checking
> itself?

I'll think about this some more. In the mean time I've reassigned the
bug to myself.

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


More information about the Python-Dev mailing list