Ian Bicking: the old part of his blog

Why python unicode sucks comment 000

Abandoning polymorphism seems extreme. I read the originating comment as 'if objects are not interchangeable, they should use differently-named methods for places where that difference lies".

Both sets and bags support addition, existence testing, held object counts, and the like. 'add' is thus a perfectly fine method for both, and usage via duck typing makes sense - if an add method exists, then I can use it. Where you run into problems is when there is a behavioral difference - a set can return only a single item, thus the idea of a 'countOfItem' method in a Set is silly. In a bag, it is not. Thus, the key behavioral difference shows up in a way visible to duck typing, and it is visible for those clients that care.

The problem with strings is that there are two different classes that have virtually identical method signatures, so client code interacting with these classes has a hard time knowing wherther it will get something that behaves well with Unicode.

Scott

Comment on Re: Why Python Unicode Sucks
by Scott Ellsworth