"Terry Reedy" <[EMAIL PROTECTED],,.edu> wrote: > "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > | I am relatively new on this turf, and from what I have seen so far, it > | would not bother me at all to tie a name's type to its first use, so that > | the name can only be bound to objects of the same type as the type > | of the object that it was originally bound to. > | > | But maybe I am missing the point of dynamism. > | > | Would an implementation of the above break lots of stuff in practice? > > For function local variables, if you mean 'originally bound to' in the > current call invocation, that would sometimes be ok (and that is sort of > what Psycho does). But if you mean in the original binding in the first > call invocation, then that would cripple many functions. > Errr - I was thinking a bit simplistic - I know I can write:
def f(x): for y in x: print y # using print here as short for doing something complicated And that would currently "work" with any iterable, as x could currently be anything. It seems that such functions are the problem, as something like this: x = [1,2,3,4,5] for y in x: print y does not have the same hassle for x, but can shift the problem to y: x = [1,2,3,4,(1,2)] for y in x: print y I can't see an easy way to put the patient back into his straight jacket. Makes you want to use pre defined globals... - Hendrik -- http://mail.python.org/mailman/listinfo/python-list