Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20188

Re: How can I catch misnamed variables?

References <jh40ti$t3i$1@reader1.panix.com>
Date 2012-02-10 21:17 +0000
Subject Re: How can I catch misnamed variables?
From Arnaud Delobelle <arnodel@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.5678.1328908625.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 10 February 2012 21:06, John Gordon <gordon@panix.com> wrote:
> Recently I was been bitten by some stupid errors in my code, and I'm
> wondering if there's a simple way to catch them.
>
> One error was of the form:
>
>  my_object.some_function()
>
> .. when I hadn't declared an object named "my_object".
>
> The other error was similar:
>
>  x = my_module.CONSTANT
>
> .. when I hadn't imported my_module.
>
> Of course both of these errors were deep inside a long-running function
> call, so it took a while for them to crop up.
>
> Is there an automated way to catch errors like these?  I'm using the
> compileall module to build my program and it does catch some errors
> such as incorrect indentation, but not errors like the above.

There's pychecker and pylint

-- 
Arnaud

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How can I catch misnamed variables? John Gordon <gordon@panix.com> - 2012-02-10 21:06 +0000
  Re: How can I catch misnamed variables? Arnaud Delobelle <arnodel@gmail.com> - 2012-02-10 21:17 +0000
  Re: How can I catch misnamed variables? Kev Dwyer <kevin.p.dwyer@gmail.com> - 2012-02-10 21:22 +0000
  Re: How can I catch misnamed variables? Ben Finney <ben+python@benfinney.id.au> - 2012-02-11 08:26 +1100
    OT (waaaayyyyyyyyy off-topic) [was Re: How can I catch misnamed variables?] Ethan Furman <ethan@stoneleaf.us> - 2012-02-10 13:56 -0800
      Re: OT (waaaayyyyyyyyy off-topic) Ben Finney <ben+python@benfinney.id.au> - 2012-02-11 09:45 +1100
  Re: How can I catch misnamed variables? Christian Heimes <lists@cheimes.de> - 2012-02-11 00:21 +0100

csiph-web