Against PEP 240
Tim Peters
tim.one at home.com
Thu May 31 20:45:30 EDT 2001
[Konrad Hinsen]
> ...
> In practice, most user-defined types make sure they interact well with
> the built-in types, but they can't possibly cope with all other
> user-defined types out there in a reasonable way.
Why not? Any coercion is allowed to return None-- and should --if it
doesn't *know* what to.
> And I am rather sure that many user-defined types would not
> behave appropriately when new built-in types appear.
I think you must have a different definition for "appropriate" <wink>.
> Moreover, with the proposed addition of a rational and/or arbitrary
> precision BCD type, it is not clear what the coercion rules between
> this and the standard float type should be. If the BCD types becomes
> "higher" and is the default for float constants, it will be almost
> impossible to do complex float calculations. If floats are declared
> higher-up in the coercion order, the the precision-conscious BCD
> people are in for bad surprises.
Tough luck for them, then. "Inexactness is contagious" is the only sensible
rule, if you *have* to cater to automagic conversions at all. I'd prefer
they raise an exception, but I'll be out-voted on that.
More information about the Python-list
mailing list