William Witteman wrote:
> I need to collect a couple of integers from a user, but I want to make
> sure that I actually get integers.  I tried this, but subsequent calls
> to the function don't update variable.  I'm not sure this is terribly
> clear - here's the code:
> 
> 
> def getinput(variable,prompt):
>   """
>   Get the input by prompting the user and collecting the response - if it is 
>   a non-integer, try again.
>   """
>   variable = 0

the source of your confusion is misunderstanding of python's calling
model. Here is an article: http://effbot.org/zone/call-by-object.htm

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to