Why not allow empty code blocks?

D'Arcy J.M. Cain darcy at Vex.Net
Fri Jul 29 07:14:58 EDT 2016


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>

If your code block really is one line is "pass #" really so much more
of a hardship than "#"?  If it is a large block use "pass #@#" which is
easy to remove with a search and replace.

In any case, the rule about premature optimization for programs can
probably be applied to developers too.  Is saving a "pass" once in a
while really where you need to focus your debugging efforts?

-- 
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:darcy at Vex.Net
VoIP: sip:darcy at Vex.Net



More information about the Python-list mailing list