On Sun, Jul 24, 2016 at 12:00 AM, BartC <b...@freeuk.com> wrote: > On 23/07/2016 12:34, Chris Angelico wrote: >> >> On Sat, Jul 23, 2016 at 9:13 PM, Marko Rauhamaa <ma...@pacujo.net> wrote: >>>> >>>> One less thing to be programmed, one less thing for the user to >>>> remember. Just require pass any time you have an empty block, rather >>>> than try to remember where it is required and were it is optional. >>> >>> >>> Actually, the requirement of a dummy statement is a slight annoyance for >>> the programmer. After deleting a statement, you must see if you have to >>> put in a pass statement. And after adding a statement, you may feel the >>> urge to remove the redundant pass statement. >> >> >> How often do you actually need empty statements, adding stuff, >> removing stuff, like that? Possibly there's a code smell here. > > > All the time?
No, or I wouldn't have qualified it with the very weak "possibly". > For example when creating a set of empty functions to be populated later, or > empty branches of if and so on to be filled in as so you go. Forget 'pass' - just give each function a docstring. That syntactically defines the block, and it's useful. > 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 -- https://mail.python.org/mailman/listinfo/python-list