[Python-3000] Type Comparisons with Godel Numbers
Edward Loper
edloper at gradient.cis.upenn.edu
Fri Apr 21 18:36:05 CEST 2006
On Apr 21, 2006, at 8:36 AM, Greg Ewing wrote:
> Guido van Rossum wrote:
>> If I have some utterly dynamic
>> code that comes up with a list of a million ints, and then I pass
>> that
>> as an argument to a function that requests the argument type is
>> list[int],
>
> you wrap it in something that checks elements for intness
> as you access them. [...]
I think it's important for code to fail early if type constraints
aren't satisifed.
The approach you suggest (wrapping the object) would cause a function
with a badly typed argument to blow up part-way through executing,
possibly at a position far-distant from the place where the type
constraint was violated, and possibly after various side-effects have
already taken place.
-Edward
More information about the Python-3000
mailing list