How to Detect Use of Unassigned(Undefined) Variable(Function)

Discussion in 'Python' started by ++imanshu, Nov 27, 2009.

  1. ++imanshu

    ++imanshu Guest

    Is there a script/module to detect the use of unassigned
    (undefined) variables(functions) in python. e.g. can I detect the
    problem on line 3 automatically :-

    i = 1
    if i == 3:
    print o
    print i

    Thank You,
    ++imanshu
    ++imanshu, Nov 27, 2009
    #1
    1. Advertising

  2. ++imanshu

    Jon Clements Guest

    On Nov 27, 10:36 am, "++imanshu" <> wrote:
    >     Is there a script/module to detect the use of unassigned
    > (undefined) variables(functions) in python. e.g. can I detect the
    > problem on line 3 automatically :-
    >
    > i = 1
    > if i == 3:
    >     print o
    > print i
    >
    > Thank You,
    > ++imanshu


    pychecker returns "test.py:3: No global (o) found" for the above, and
    can be found at http://pychecker.sourceforge.net/

    There's also pylint and another one whose name I can't remember...

    hth
    Jon.
    Jon Clements, Nov 27, 2009
    #2
    1. Advertising

  3. Jon Clements wrote:

    > pychecker returns "test.py:3: No global (o) found" for the above, and
    > can be found at http://pychecker.sourceforge.net/
    >
    > There's also pylint and another one whose name I can't remember...


    pyflakes. I use that one
    Marco Mariani, Nov 27, 2009
    #3
  4. ++imanshu

    ++imanshu Guest

    On Nov 27, 4:06 pm, Marco Mariani <> wrote:
    > Jon Clements wrote:
    > > pychecker returns "test.py:3: No global (o) found" for the above, and
    > > can be found athttp://pychecker.sourceforge.net/

    >
    > > There's also pylint and another one whose name I can't remember...

    >
    > pyflakes. I use that one


    Thanks for the replies. Was looking for just these.

    Thank You,
    ++imanshu
    ++imanshu, Nov 28, 2009
    #4
    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. Replies:
    16
    Views:
    901
  2. Ron
    Replies:
    0
    Views:
    650
  3. Simon Strandgaard

    [RCR] nil for unassigned keys

    Simon Strandgaard, Jul 19, 2005, in forum: Ruby
    Replies:
    16
    Views:
    260
    Daniel Brockman
    Jul 19, 2005
  4. Bernd
    Replies:
    8
    Views:
    130
    Robert Dober
    May 13, 2007
  5. J. Romano
    Replies:
    21
    Views:
    307
    Sisyphus
    Dec 14, 2004
Loading...

Share This Page