On Thu, 31 Jul 2008 02:41:08 +0000, Steven D'Aprano wrote: > On Wed, 30 Jul 2008 09:23:05 -0600, Matthew Fitzgibbons wrote: ... >> Although, if my function is expecting a list, my preference is to do: >> >> if not isinstance(x, list): >> raise SomeMeaningfulException() >> # do stuff with the list >> >> I put my type checking at the top of the function, so readers can >> reference it easily. > > And thus you break duck-typing and upset anybody who wants to pass a > sequence that doesn't inherit directly from list.
Correction: delete "directly" from the above. -- Steven -- http://mail.python.org/mailman/listinfo/python-list