looking for design pattern name

Alex Martelli aleax at aleax.it
Sun Aug 3 11:28:46 EDT 2003


John J. Lee wrote:

> "Andrew Dalke" <adalke at mindspring.com> writes:
> [...]
>> Quoting from the docs,
>>    exception TypeError
>>    Raised when a built-in operation or function is applied to an object
>>    of inappropriate type. The associated value is a string giving details
>>    about the type mismatch.
>> 
>> In addition to your comments, this is not a built-in operation, so it's
>> the wrong exception.
> [...]
> 
> Hmm, I don't think that's what the docs meant to communicate -- you're
> allowed to use it in your non-builtin code.  At least, that's what
> I've always assumed:

I agree with your interpretation.  Lots of NON-builtin code that is
GvR-approved, e.g. throughout the Python libraries, happily raises such
exceptions as TypeError, so it does seem that the above-quoted para
must NOT be read as "Raised ONLY when a built-in" (etc) but rather
as "Raised (among other circumstances) when a built-in" (etc).


Alex





More information about the Python-list mailing list