Exception handling wart in Python
Paul Rubin
phr-n2001d at nightsong.com
Fri Nov 2 23:08:08 EST 2001
"Leo Lipelis" <aeoo at myspamrealbox.com> writes:
> Ok looking at above it's not possible. But how about here:
>
> ---begin script---
> def foo(frob):
> x = frob.mumble()
>
> foo("String") # let's assume that string class has mumble method
> foo(5)
> foo(gdbm.open("bar", "rf"))
> ---end script---
>
> At some point you do know the type. You just have to infer it. I agree
> that makes it more difficult than in Java.
In real Python code the way people write it, I don't think you can
infer types that way often enough to be useful. Try another language,
like ML.
More information about the Python-list
mailing list