On 1/31/2010 7:25 PM, Steven D'Aprano wrote:
On Sun, 31 Jan 2010 15:40:36 -0800, Chris Rebert wrote:

On Sun, Jan 31, 2010 at 2:36 PM, Steven D'Aprano
<st...@remove-this-cybersource.com.au>  wrote:
On Sun, 31 Jan 2010 04:28:41 -0800, Ed Keith wrote:
In most functional languages you just name a function to access it and
you do it ALL the time.

for example, in if you have a function 'f' which takes two parameters
to call the function and get the result you use:

  f 2 3

If you want the function itself you use:

    f

How do you call a function of no arguments?

It's not really a function in that case, it's just a named constant.
(Recall that functions don't/can't have side-effects.)

Three of you gave essentially identical answers, but I still do not see how given something like

def f(): return 1

I differentiate between 'function object at address xxx' and 'int 1' objects.

time.time(), random.random()
(1264983502.7505889, 0.29974255140479633)
time.time(), random.random()
(1264983505.9283719, 0.74207867411026329)

They don't look terribly constant to me.

I believe these are not functions in a functional language sense. Neither are input and output 'functions'. So all of these are either missing or some sort of special function-like something.

I personally take a broader view of functions and include the relevant environment in their input and output, so that there are no 'side effects'. The concept of 'side-effect' is somewhat arbitrary. In fields other than computing, like pharmacology and politics, its meaning is somewhat different and a bit corrupt.

There is a difference between a function that does "give me whatever
value is specified by a fixed description" and a function that does "give
me a fixed value".

Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to