On PEP 312: simple implicit lambda

Christos TZOTZIOY Georgiou DLNXPEGFQVEB at spammotel.com
Sun Feb 16 18:39:10 EST 2003


On Sun, 16 Feb 2003 17:56:15 GMT, rumours say that Manuel M. Garcia
<mail at manuelmgarcia.com> might have written:

>The usual idiom used in this case is:
>
>    while 1:
>        data = file_object.read(4096)
>        if not data: break
>        # process here

Yes, I use that too.

>I agree it is not perfect.  I never prefer an infinite loop, and I
>always try my best to put the loop termination condition as part of
>the 'while' statement.

The iter function with two arguments is often a nice help for loop
conditions...

>Here is another Python trick inside of a little test program:

<snip of a function with an internal class>

Interesting, but I find it too fussy.  I'd still prefer
'loop-and-a-half' to it.

Thanks for your time, anyway :)
-- 
TZOTZIOY, I speak England very best,
Real email address: 'dHpvdEBzaWwtdGVjLmdy\n'.decode('base64')




More information about the Python-list mailing list