[Tutor] more newbie questions: variables without a value
Deirdre Saoirse Moen
deirdre@deirdre.net
Thu, 28 Jun 2001 12:44:02 -0700
At 9:33 PM +0200 6/28/01, Brendon wrote:
> > >the line: "for msg in note:" doesn't seem to make sense because "msg" has
>> > no value nor is it pointing to "note".
>>
>> There's an implied assignment that the first variable is assigned to
>> the current value of the second part. Like:
>>
>> for i in xrange(25, 51, 5):
>> print i
>
>oh, ofcourse.. (!..) sorry, i keepon thinking about C loops :)
In C, the assignment is more explicit:
for (i = 25; i < 51; i++)
printf("%d\n", i);
Strangely, this is the first time I've thought the C syntax was more
obvious simply and only because the python syntax confused you.
The "x in foo" construct is also used in SQL, so I'm used to seeing it.
--
_Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net
"Cannot run out of time.... Is infinite time. You... are finite....
Zathrus... is finite. This... is wrong tool!" -- Zathrus