Closed cyroxx closed 10 years ago
Do you have an example in which the strict checks are an issue - for now I can only think about cases where int or str is subclassed. It would be good if you would add this directly as tests, so it will not again broken in the future.
You are completely right, this is an issue if you have subclasses of the built-in types at hand. However, I think it is not necessary to strictly enforce the exact type in those cases addresses by this PR.
An example comes from working with BeautifulSoup: There you have the str
subclass NavigableString
. Although this class behaves pretty much the same as a plain string, I had to convert my price instances using str(myprice)
before I could throw them to convertPrice/buildPrices. This should not be mandatory since they are children of str
in the inheritance tree.
Released as 0.91.0
The price conversion is now able to deal with subclasses of int, float, str and not only the exact types.
This gives greater flexibility when working with subclasses, as you do not have to explicitly convert to the corresponding supertype.