|
From: <bc...@wo...> - 2001-04-04 21:45:35
|
[Robert W. Bill]
>Hello all,
>
>I was curious about the builtin "coerce" and what it should do
>with non-numeric types.
>
>Currently in CPython
>>>> coerce(1,"a")
>Traceback (most recent call last):
> File "<stdin>", line 1, in ?
>TypeError: number coercion failed
>>>>
>
>Currently in Jython
>>>> coerce(1, "a")
>(1, 'a') <-- note: not the same type
>>>>
>
>It seems the typeerror should be raised, but as always, it's likely
>there's something I've missed or misunderstood (maybe in PEP208 or
>elsewhere). Sorry if I'm off yet again, but I was wondering if the
>fall-through return of __builtin__.java::coerce should instead raise the
>TypeError("number coercion failed").
I agree with your patch.
regards,
finn
|