function returns , but variable values has not changed in the interactive prompt
davidj411
davidj411 at gmail.com
Fri May 23 15:04:43 EDT 2008
if you run execfile function to run a python script and that script
has variables and functions, should't those variable change in the
interactive prompt too?
script snippet that calls the function which should return like this
return (stuffedname,bigstring, numbertimes,num_times_search_string)
this is the variable that calls the functions. when a function returns
something AND there is a variable set as shown immediately below,
does't the variable get updated?
tu_count = CountStrings (name, balance, searchstr)
this is the output from the script.
notice how tu_count actually differs when called from interactive
prompt after script exits.
tu_count: ('peterjackson', 'peterjacksonpeterjacksonpeter', 2, 0)
<type 'tuple'>
>>> tu_count
('davidjacksondavidjacksondavid', 2, 0)
thanks
More information about the Python-list
mailing list