In <d7191cec-d963-42c8-90ba-db6d1359c...@googlegroups.com> Coolgg <gauravj...@gmail.com> writes:
> Is this: > while True: > data = fp.read(4096) > if not data: > break > ... > not equivalent to this: > data = fp.read (4096) > while data: > ...{handle the chunk here} > data = fp.read (4096) It looks equivalent to me (in terms of control flow). But in the second example the fp.read() statement is duplicated, which is undesirable. It would be all too easy for a maintenance programmer to go into the code a year from now and change the first one but miss the second one. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list