Adding more warnings

Discussion in 'Python' started by Thomas Dybdahl Ahle, Feb 19, 2008.

  1. I tend to make a lot of mistakes of misspelled variable names.

    Is it possible to make python warn me about those at "compile time"?

    Very few times I use dynamic variable initialization. I can live with
    getting a warning for those as well.

    --
    Best Regards,
    Med Venlig Hilsen,
    Thomas
    Thomas Dybdahl Ahle, Feb 19, 2008
    #1
    1. Advertising

  2. Thomas Dybdahl Ahle

    Ben Finney Guest

    Thomas Dybdahl Ahle <> writes:

    > I tend to make a lot of mistakes of misspelled variable names.


    You would greatly benefit from using tools like 'pyflakes', 'pylint',
    and a unit test suite for your code. They're very good for finding
    such simple bugs in your code.

    > Is it possible to make python warn me about those at "compile time"?


    The names are resolved at run time, so the compiler has insufficient
    information to say whether a name is used incorrectly.

    --
    \ "Program testing can be a very effective way to show the |
    `\ presence of bugs, but is hopelessly inadequate for showing |
    _o__) their absence." -- Edsger Dijkstra |
    Ben Finney
    Ben Finney, Feb 20, 2008
    #2
    1. Advertising

  3. "Thomas Dybdahl Ahle" <> skrev i en meddelelse
    news:...

    > Is it possible to make python warn me about those at "compile time"?


    No. The compiler only "knows" about it once the broken code is run. I use
    the standard module "unittest" to run through every single bit of Python
    code I write.

    Maybe silly, but ... I think it saves me time in the end and forces me to
    think more about my interfaces because one of the early symptoms of stupid
    design is that the test code is a real pain to write. At least Python
    applications tend to be compact compared with C++/Java.
    Frithiof Andreas Jensen, Feb 22, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael
    Replies:
    4
    Views:
    408
    Matt Hammond
    Jun 26, 2006
  2. asdf

    more warnings

    asdf, Jun 26, 2006, in forum: C++
    Replies:
    1
    Views:
    345
    Marcus Kwok
    Jun 26, 2006
  3. Roedy Green

    More Generics warnings.

    Roedy Green, Jan 1, 2008, in forum: Java
    Replies:
    5
    Views:
    348
  4. Robert Klemme

    With a Ruby Yell: more, more more!

    Robert Klemme, Sep 28, 2005, in forum: Ruby
    Replies:
    5
    Views:
    215
    Jeff Wood
    Sep 29, 2005
  5. Ted Sung
    Replies:
    1
    Views:
    307
    Sherm Pendley
    Aug 30, 2004
Loading...

Share This Page