> "JS" == Jeff Shannon <[EMAIL PROTECTED]> writes:
JS> Python was designed with the thought that the average programmer spends
JS> *far* more time *reading* code than writing code. So the intent of Python
JS> syntax is to make code that is easy to *read*, even if it takes a little bit
JS
[EMAIL PROTECTED] wrote:
> The range() function a nice one to create a list and enumerate it with a
> 'foreach'.
> But it creates a static list and enumerates it.
> The spice of 'for' of perl, java, C and ... is that you haven't know the
> list before you enumerate it.
Which creates all sorts
try 'for in' as in:
def func(aref):
return [aref] * 3
a = 'else!'
for b in func(a):
print 'something' + b
#David
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 26, 2002 4:29 AM
To: [EMAIL PROTECTED]
Subject: loop control in Pyt
some C compilers - on Mac or Irix - will warn you about that sort of behaviour
(even if you put brackets around it). There are the infinite loops and the
infamous one = test traps (a == comparison is needed, but a = is left off).
perl -we while($line=)
At 26/04/2002 12:29:01, [EMAIL PROTECTED] w
Janos,
Hi, you can use range() together with for (and probably other methods as
well), e.g.
start=100
stop=120
step=3
for i in range(start, stop, step):
print i
should do the trick, you can also play around with negative parameters to
range()
Good luck.
Amund
http://www.idi.ntnu.no/~amund
for i in range(1,5):
print i
At 26/04/2002 10:58:13, [EMAIL PROTECTED] wrote:
# Python was my biggest surprise last year. I found it be very usefull and
# tasty. The IDLE gives really fantastic opportunities. It is really GRAND.
# My only problem with python is the missing 'for '.
# The