Why not allow empty code blocks?

Terry Reedy tjreedy at udel.edu
Fri Jul 29 15:43:02 EDT 2016


On 7/29/2016 4:58 AM, Antoon Pardon wrote:
> Op 23-07-16 om 16:19 schreef Chris Angelico:
>> On Sun, Jul 24, 2016 at 12:00 AM, BartC <bc at freeuk.com> wrote:
>>> Or, for debugging or other reasons, when you need to comment out the
>>> contents of a block. Then pass needs to be added.
>> How often do you comment out an entire block and not its header? I
>> don't remember the last time I did that. It's certainly not so common
>> that adding 'pass' takes up a significant part of a debugging session.
>>
>> ChrisA
>
> As BartC already mentions it happens fairly often during debugging.
> Something like.
>
> try:
>    Some code
> except Some_Exception:
>    # Commented code for when I am debugging <Some code>
>    pass

So put in 'pass' whether or not there is no debugging code, 
commented-out debugging code, or debugging code that runs, or whatever.

-- 
Terry Jan Reedy




More information about the Python-list mailing list