looking for design pattern name

John J. Lee jjl at pobox.com
Thu Jul 31 14:17:49 EDT 2003


"Andrew Dalke" <adalke at mindspring.com> writes:

> Raymond Hettinger:
> > What happens in Bond() if O1 and O2 have different parents?
> 
> Raises an exception - TypeError seems best.  Here's the code
[...]

Yuck.  Doesn't the standard library reserve TypeError for occasions
where the, um, type of an argument is not appropriate?  'Type' does
generally means the interface rather than type(object), but that's
quite different to what you're checking.  Checking whether atoms have
different parents surely isn't a type check.  Why not ValueError or
your own exception (possibly derived from ValueError)?

[.........]
> Err, I tangented, didn't I.
[...]

"Verbing weirds language", to quote Calvin.

:-)


John




More information about the Python-list mailing list