|
|
|
I think that's a perfect example of a great mixin style of multiple-inheritance, and I don't see any problems with it. I'll keep an eye on this in case anyone thinks different.
Jonathan Hartley |
Homepage |
07/06/07 - 3:22 pm | #
|
|
What about "def getSpecialValue()" begin your factory for float and str, and "SpecialValue = (float, str)"?
isinstance(v1, SpecialValue) would still work. The drawback would be that you couldn't do isinstance(v1, (SpecialValue, OtherType))
I'm not saying it's a better solution, I'm just giving an alternative.
Virgil Dupras |
Homepage |
07/06/07 - 4:18 pm | #
|
|
Virgil - the point is that I need to be able to distinguish *between* 'SpecialValue' and other ordinary floats and strings.
Fuzzyman |
Homepage |
07/06/07 - 8:32 pm | #
|
|
I had kind of figured that out a few seconds after having submitted my comment. This requirement wasn't clear from your code snippet though. You shouls have added:
v3 = 1.2
assert not isinstance(v3, SpecialValue)
Virgil Dupras |
Homepage |
07/06/07 - 9:48 pm | #
|
|
|
Commenting by HaloScan
|