On Aug 1, 4:45 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Aug 1, 3:36 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > > In general, asking code to apply across numeric, container, and other > > classes is asking too much. Python code can be generic only within > > protocol/interface categories such as number-like, sortable, and > > iterable. But making tests too specific can unnecessarily prevent even > > that. > > At some point we have to throw our hands up and realize that if we're > working with custom classes with varying degrees of nonconformance, > there is nothing we can do that's safe.
And I want to make clear I'm not trying to downplay your example here. The example you gave me definitely fits the criteria of being a useful "if x" that can't be replaced by a simple explicit test, at least after my alteration to a vector example. It's a concern when you write code that breaks realistic custom classes, but really concerning when it breaks built-in classes. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list