[Python-Dev] ACCEPTED: PEP 285

David Ascher DavidA@ActiveState.com
Wed, 03 Apr 2002 16:14:46 -0800


Neal Norwitz wrote:
> 
> David Ascher wrote:

> > Come to think of it, getting PyChecker integrated w/ the interactive
> > shell would be great!  Hard, I suspect, but great!
> 
> Not too hard:
> 
>         >>> from pychecker import checker
>         >>> import test_bool
>         test_bool.py:6: Comparisions with True are not necessary
>         test_bool.py:7: Comparisions with False are not necessary
> 
> If you always wanted this, you could add a PYTHONSTARTUP script
> to do the import or you could add/modify sitecustomize.py.

That's nice, but it doesn't deal with the real novice's usage, which is
to learn at the >>> prompt, not in modules.

E:\tmp>cat > foo.py
cat: Reading input from keyboard:
def foo():
   a = 3
   return 3
^Z
E:\tmp>python
ActivePython 2.2.0 Build 221 (ActiveState Corp.) based on
Python 2.2 (#28, Mar 28 2002, 12:10:20) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pychecker import checker
>>> import foo
foo.py:2: Local variable (a) not used    
>>>

that's nice, but:

>>> def foo():
...   a = 3
...   return 3
...
>>>

The fact that it doesn't pick up on the unused variable is too bad.  The
integration I'm thinking of would be deeper.

--da