[Tutor] Generators
Luke Paireepinart
rabidpoobear at gmail.com
Tue Jul 24 02:57:57 CEST 2007
Tiger12506 wrote:
>> I am new to Python but not new to programming languages. I have seen this
>> "while 1" a lot. In fact in other languages I would expect "while 1" to
>> be
>> the same as "while TRUE". I have used that in other languages, but in the
>> definition below I would expect the "yield b..." to continue on until a
>> "break". So the question is, how does this work without going into an
>> infinite loop without a break?
>>
>> Jeff
>>
>
> while 1: and while TRUE: mean the same thing.
> The thing is - it is an infinite loop.
This should be
while True:
not
while TRUE:
unless you set TRUE = True beforehand, since Python is case-sensitive.
-Luke
More information about the Tutor
mailing list