Kent Tong wrote: > Hi > > I'm aware that we can use 'pass' as an empty code block. But why doesn't > python allow a code block to be empty and thus eliminate the need for this > null statement? > > thanks in advance
Because it's more likely that you have an indentation error than an intentional need for an empty code block, and Python's trying to prevent you shooting yourself in the foot. If you actually needed an empty code block, the langugage provides a way of marking that emptyness as intentional. That way is the pass statement. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman/listinfo/python-list