Re: [Python-ideas] Statement local functions and classes (aka PEP 3150 is dead, say 'Hi!' to PEP 403)
Mike Meyer wrote:
- And testing. If code isn't tested, you should assume it is buggy. In an ideal world, there should never be any such thing as code that's used once: it should always be used at least twice, once in the application and once in the test suite. I realise that in practice we often fall short of that ideal, but we don't need more syntax that *encourages* developers to fail to test non-trivial code blocks.
Statement-local namespaces don't do that any more than other statement that includes a suite does. Or do you avoid if statements because they encourage you not to test the code in the else clause?
if...else blocks aren't being proposed as a way to avoid writing functions. It's not that I think the proposal is bad in and of itself, but I do think it is unnecessary and I fear it will encourage poor practices. -- Steven
participants (1)
-
Steven D'Aprano