From: davidtmoore at my-dejanews.com (davidtmoore at my-dejanews.com)
Date: Fri, 23 Apr 1999 21:17:10 GMT
Subject: Style/efficiency question using 'in'
References: <3720B3B9.98BED320@earth.ox.ac.uk>
Message-ID: <7fqo0i$k85$1@nnrp1.dejanews.com>
X-UID: 1353                                                  

In article <3720B3B9.98BED320 at earth.ox.ac.uk>,
  Nick Belshaw <nickb at earth.ox.ac.uk> wrote:
> 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
> ------------------

This may not be appropriate to the problem that you are really trying to
solve, but are you aware of this (range(n) will make your list for you):

>>> range(8)
[0, 1, 2, 3, 4, 5, 6, 7]
>>> for x in range(8):
... 	print x+1
...
1
2
3
4
5
6
7
8
>>>

----
David Moore

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




