On Mon, 28 Oct 2013 22:18:45 +1100, Chris Angelico wrote:

> On Mon, Oct 28, 2013 at 10:14 PM, Steven D'Aprano
> <steve+comp.lang.pyt...@pearwood.info> wrote:
>> if needs_preprocessing:
>>     for elem in iterable:
>>         # If you change this block, you must remember to change the #
>>         block below too!
>>         preprocess(item)
>>         do_this(item)
>>         do_that(item)
>>         do_something_else(item, arg1, arg2, expression)
>>         do_another_thing(item + arg3, key=whatever) print(item)
>> else:
>>     for elem in iterable:
>>         # If you change this block, you must remember to change the #
>>         block above too!
>>         preprocess(item)
>>         do_this(item)
>>         do_that(item)
>>         do_something_else(item, arg1, arg2, expression)
>>         do_another_thing(item, key=whatever)
>>         print(item)
>>
>>
>> The careful reader will notice that there's already a bug in this.
> 
> For a start, you're preprocessing in the second block... I don't think
> that was your intentional bug :)

Heh, no, that wasn't the intentional bug. But it does go to show the 
risks of copy-and-paste programming.



-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to