Status of PEPs?

Duncan Booth me at privacy.net
Fri Jul 2 09:44:41 EDT 2004


Heather Coppersmith <me at privacy.net> wrote in
news:m2d63ed0e8.fsf at unique.phony.fqdn: 

> On 02 Jul 2004 15:37:30 +0300,
> Ville Vainio <ville at spammers.com> wrote:
> 
>> while 1:
>>   a = getobject()
>>   if a is None:
>>     break                # flag doesn't work, you'd need to do
>>     "continue" 
>>   process(a)
>>   morestuff(a)
> 
>     keep_trying = True
>     while keep_trying:
>         a = getobject( )
>         if a:
>             process( a )
>             morestuff( a )
>         else:
>             keep_trying = False
> 
> Or:
> 
>     a = getobject( )
>     while a:
>         process( a )
>         morestuff( a )
>         a = getobject( )
> 

Or for those of a less masochistic inclination, just use a for loop:

for a in iter(getobject, None):
    process(a)
    morestuff(a)



More information about the Python-list mailing list