PEP 238 (revised)

Gustavo Niemeyer niemeyer at conectiva.com
Fri Jul 27 13:12:19 EDT 2001


> The PEP can't address everything.  I have no idea how to write such a
> scanner, and I think it would require type inference of unrivaled
> sophistication, so I'm not keen on promising it in the PEP.  I assume
> there will be some kind of conversion tool, but it's outside the scope
> of the PEP.

I don't think a perfect solution for this will ever exist, besides
interpreter warnings when running the code. But some assumptions may be
used to detect problems in some cases. Something that came into my
mind right now is about lists. I don't know if this issue has been
discussed before:

>>> [1,2][0.0]
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: sequence index must be integer

So, if some algorithm uses a value returned from a division as a
list index, it will certainly be an error in the future.

Maybe a nice idea in this case would be to allow lists to accept
float indexes. This could preserve some old code. But I'm not sure
making such thing possible is nice, in the long run.

-- 
Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]




More information about the Python-list mailing list