Why not allow empty code blocks?

Ian Kelly ian.g.kelly at gmail.com
Fri Jul 29 09:41:49 EDT 2016


On Jul 29, 2016 7:22 AM, "BartC" <bc at freeuk.com> wrote:
>
> On 29/07/2016 12:14, D'Arcy J.M. Cain wrote:
>>
>> On Fri, 29 Jul 2016 10:58:35 +0200
>> Antoon Pardon <antoon.pardon at rece.vub.ac.be> wrote:
>>>
>>> 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
>>
>>
>> I realize that that's a simplified example but really, isn't this just
>> as easy?
>>
>> try:
>>    Some code
>> # except Some_Exception:
>>    # Commented code for when I am debugging <Some code>
>
>
> Will it behave the same way when there is a Some_Exception exception?

Besides that, a try block on its own with no dependents blocks isn't even
legal syntax. You'd have to comment the try as well and replace it with "if
1" or similar.



More information about the Python-list mailing list