[Python-3000] Type Comparisons with Godel Numbers

Guido van Rossum guido at python.org
Fri Apr 21 15:06:33 CEST 2006


On 4/21/06, Greg Ewing <greg.ewing at canterbury.ac.nz> 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. It'll still check a million ints if
> you access them all, but that would have to be done anyway
> if you were passing the list to fully dynamic code. And
> it spreads the cost of doing it out over whatever is
> being done with the ints, rather than doing it all up
> front. And it doesn't bother checking any ints that you
> don't use.

That's the conclusion we reached last time too. Unfortunately the
wrapper slows down each access. I guess we could disable all checking
when -O is used...

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list