Calling Function Without Parentheses!

John Machin sjmachin at lexicon.net
Sun Jan 2 21:28:52 EST 2005


Kamilche wrote:
> What a debug nightmare! I just spent HOURS running my script through
> the debugger, sprinkling in log statements, and the like, tracking
down
> my problem.
>
> I called a function without the ending parentheses. I sure do WISH
> Python would trap it when I try to do the following:
> MyFunc
>
> instead of:
>
> MyFunc()
>
> aaaaaaaaaaaah.

Aaaaaaaaaaaah indeed. You must be using an extremely old version of
pychecker. The version I have in my Python22 directory gave the same
results as the current one; see below.

C:\junk>type noparens.py
[bangs inserted to defeat Google's lstrip()
!def bar():
!   foo
!def foo():
!   alist = []
!   alist.sort



C:\junk>pychecker noparens.py

C:\junk>c:\python24\python.exe
c:\python22\Lib\site-packages\pychecker\checker.py noparens.py
Processing noparens...

Warnings...

noparens.py:2: Statement appears to have no effect
noparens.py:5: Statement appears to have no effect




More information about the Python-list mailing list