"sins" (aka, acknowledged language problems)
William Tanksley
wtanksle at hawking.armored.net
Tue Jan 4 16:58:02 EST 2000
On Tue, 04 Jan 2000 01:52:49 +1100, skaller wrote:
> One problem with this approach is that it based around
>a generic calling protocol -- which is as slow as a wet week in Python.
>For example, I have extended the for statement in Viper, to accept
>dictionaries and sets. It is very inconvenient to get the i'th, or
>even the next, element from a set: I have a natural way to apply
>a function to each element.
> As a result, Viper loops are one of the things that Viper
>currently does faster than CPython -- the iteration time
>is effectively zero, and that is what pystone reported on my machine.
You know, I didn't realize that. You asked earlier about whether you
should implement 'ifor' to augment 'for'. I suggested that you use a
seperate function, such as "for i,x in list.items():". I see now that you
want entirely different behavior.
Okay, two suggestions. First and best, don't add any additional keywords
or syntax; instead, build your optimizer to recognize and optimize that
idiom. Second, add some non-keyword syntax: for example, the above could
be written as "for x[i] in list:".
--
-William "Billy" Tanksley, in hoc signo hack
More information about the Python-list
mailing list