[Python-Dev] Wishlist: dowhile

Michael Chermside mcherm at mcherm.com
Mon Jun 13 21:36:33 CEST 2005


Jp Calderone writes:
>  for chunk in iter(lambda: f1.read(CHUNK_SIZE), ''):
>      f2.write(chunk)

Phillip J. Eby responds:
> Showoff.  ;)
>
> More seriously, I think your translation makes an excellent argument in
> *favor* of having a do/while statement for greater clarity.  :)

Interesting... I had the opposite reaction. I often see someone do
something "far too clever", which looks cute and impresses me, but
makes me think that one would be wiser to avoid clever tricks and
just write straightforward (if dull) code.

But when I read JP's code I immediately thought that it WAS the
straightforward way to write that code, and that I was just not
smart enough to have realized it until he showed me.

-- Michael Chermside



More information about the Python-Dev mailing list