Forgetting "()" when calling methods

Steven Taschuk staschuk at
Mon Apr 28 02:36:57 CEST 2003

Quoth Klaus Meyer:
  [cases when omitting () from a function call causes strange behaviour
   instead of an exception]
> You are right. I had made this error maybe 2 or 3 times and found the bug 
> fast and without problems.
> But because it's a simple "typing error" or so, i am not save to make this 
> error again... :-(

It's interesting that you think of omitting the () on a function
call as a "typing error".

The need for () might become easier to remember when it is
strongly associated with the conceptual distinction between
calling the function and mentioning it.  (This distinction will
become important to you when you start using functions as
first-class objects -- e.g., passing them as arguments to other
functions, producing them as return values from your own
functions, and the like.)  Then it becomes not a typing error but
a thinking error, which is less likely.

Steven Taschuk                             staschuk at
"I may be wrong but I'm positive."  -- _Friday_, Robert A. Heinlein

More information about the Python-list mailing list