de...@web.de (Diez B. Roggisch) writes:

> John Nagle <na...@animats.com> writes:
>
> > I think that somewhere in "suds", they subclass the "unicode" type.
> > That's almost too cute.
> >
> > The proper test is
> >
> >     isinstance(s,unicode)
>
> Woot, you finally discovered polymorphism - congratulations!

If by “discovered” you mean “broke”.

John, polymorphism entails that it *doesn't matter* whether the object
inherits from any particular type; it only matters whether the object
behaves correctly.

So rather than testing whether the object inherits from ‘unicode’, test
whether it behaves how you expect – preferably by just using it as
though it does behave that way.

-- 
 \     Lucifer: “Just sign the Contract, sir, and the Piano is yours.” |
  `\     Ray: “Sheesh! This is long! Mind if I sign it now and read it |
_o__)                                later?” —http://www.achewood.com/ |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to