[Python-ideas] Statement local functions and classes (aka PEP 3150 is dead, say 'Hi!' to PEP 403)
Steven D'Aprano
steve at pearwood.info
Tue Oct 25 01:16:27 CEST 2011
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
More information about the Python-ideas
mailing list