wasm-demo/demo/ermis-f/python_m/cur/1599

34 lines
681 B
Plaintext

From: nickb at earth.ox.ac.uk (Nick Belshaw)
Date: Fri, 23 Apr 1999 18:54:01 +0100
Subject: Style/efficiency question using 'in'
Message-ID: <3720B3B9.98BED320@earth.ox.ac.uk>
X-UID: 1599
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