RFC: Viper: yet another python implementation
John Max Skaller
skaller at maxtal.com.au
Fri Aug 20 23:53:59 CEST 1999
On 16 Aug 1999 14:09:49 GMT, graham at sloth.math.uga.edu (Graham Matthews) wrote:
>graham at sloth.math.uga.edu (Graham Matthews) writes:
>: > : s = ""
>: > : for i in range(1,10): s = s + str(i)
>: > :
>: > : Obviously i is an integer here, and s a string.
>: > Is it? Surely that depends on what "range" and "+" are bound to at
>: > runtime.
>Martin von Loewis (loewis at informatik.hu-berlin.de) wrote:
>: He said that in Viper, range is a keyword. How could you bind "+" to
>: something else in the example?
>You might have bound it in some code previous to this.
It is possible to detect if this might be the case,
provided we exclude rebinding 'range' in an 'exec'.
And, since most people don't rebind range,
assuming it isn't is probably reasonable.
>If you are
>planning to compile this code then you have to compile it so that it
>will run in all contexts.
No, I don't. I plan to compile _whole_ programs.
The result of compiling a function 'f' in some module 'm'
could be different in different programs. In fact,
it could be different for different _calls_: there could be
two or more versions of one function, depending on
>What I would like to know here is what is the type of range(1,10)?
At present, it has type 'IntRange' which is analogous
to Python 1.5.2's type 'XRange': a dictinct type which is a sequence.
John Max Skaller ph:61-2-96600850
mailto:skaller at maxtal.com.au 10/1 Toxteth Rd
http://www.maxtal.com.au/~skaller Glebe 2037 NSW AUSTRALIA
More information about the Python-list