PyWart: NameError trackbacks are superfluous

Chris Angelico rosuav at gmail.com
Sat Mar 16 19:48:23 EDT 2013


On Sun, Mar 17, 2013 at 10:36 AM, Tim Chase
<python.list at tim.thechases.com> wrote:
> Because, in the real world, that example looks something like
>
>   def broken(intelligence_level):
>     if intelligence_level < 100:
>       return dumb_down(intellegence_level)
>     else:
>       return make_harder(intelligence_level)
>   broken(op.iq)
>
> Pylint, pyflakes or some other such linter should catch it, but this
> happens ALL THE TIME in actual development, occasionally leaking into
> production.

That's actually an argument in favour of declared variables. NameError
becomes a parse-time failure :)

ChrisA



More information about the Python-list mailing list