From: symion <sy...@pr...> - 2008-10-24 14:40:21
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body bgcolor="#ffffff" text="#000000"> <font size="-1"><br> I have been studying Vpython modules Text and Controls and I am a little confused by the use of 'range'.<br> The __init__ parameter list looks like this:<br> <br> def __init__(self, x=0, y=0, width=300, height=320, range=100,title=None, foreground=None, background=None):<br> <br> Now RANGE is of course a keyword, but it is being used here as a variable.<br> <br> Using IDLE 1.2.2 produces the following error.<br> <br> >>> range=100<br> >>> range<br> 100<br> >>> for a in range(1,10):<br> print a<br> <br> Traceback (most recent call last):<br> File "<pyshell#5>", line 1, in <module><br> for a in range(1,10):<br> TypeError: 'int' object is not callable<br> <br> Am I missing something?<br> <br> Also, I have cleaned up my <a href="http://home.primusonline.com.au/knoware/python/index.html">Web page</a><a style="color: rgb(0, 0, 255);" href="http://home.primusonline.com.au/knoware/python/index.html"></a><br> </font><font size="-1"><br> </font> </body> </html> |