funcs without () like print

Paddy paddy3118 at netscape.net
Thu Dec 7 12:53:20 EST 2006


iwl wrote:

> Hello can I make funktions callable without () like print
> at time the interpreter seems to printout the adres when I type the
> function without ()

Hi iwl,
its one of the python fundamentals when dealing with functions.

function_name without the () refers to the function object, that can be
passed around like any other object.
function_name() with the () calls the object referred to by the
function name, attempting to execute the code within it.

So no. you can't call functions without the (), but python provides an
easy way to know when you are calling a function or not: just look for
the ().

- Paddy.




More information about the Python-list mailing list