Style/efficiency question using 'in'
Nick Belshaw
nickb at earth.ox.ac.uk
Fri Apr 23 13:54:01 EDT 1999
If someone could spare a mo to clarify -
If I do something like :-
------------------
def func1():
return 1,2,3,4,5,6,7,8
for x in func1():
print x
------------------
it works as expected but is the use of a function in a loop undesirable?
Is the function called once to build the loop or is it called each loop
increment and therefore undesirable if there is much overhead?
greatful for any comments
cheers
Nick/Oxford
More information about the Python-list
mailing list