Q: Python 2.0 preliminary features?

Michael Hudson mwh21 at cam.ac.uk
Sun Oct 17 15:52:38 EDT 1999


skaller <skaller at maxtal.com.au> writes:

[snip tantalizing class/types ideas]
> 	The basic optimisations are functional, that is,
> things like making string concatenations go faster in cases like:
> 
> 	x  = x + "hello"
> 
> Here, the deduction starts with the literal "hello"
> which
> is known to be a string, and, since + accepts a string
> RHS only when the LHS is also a string or an int,
> and the int case is eliminated since the type of the LHS
> of the assignment is also the type of X, and both
> operators called + with string RHS return a string,
> then x must be a string.

Hold it there a second; you are proposing that knowing that x has a
certain type in the expression

x = x + "hello"

has an impact on inference? That's a BIG sea change from
CPython. Haven't you ever done this:

option = raw_input("enter a parameter> ")
try:
    option = int(option)
except:
    print "get a Clue"

OK, contrived example. But the same name can refer to variables of
different types at different times, so I don't think you can use that
for inference.

Regards,
Michael

PS: Given the bizarre reluctance of my university to give me any work,
can I ask if the source to viperi (at least) will be perusable anytime
soon?




More information about the Python-list mailing list