Terry Reedy <tjre...@udel.edu> writes:
> 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.

In the languages they are talking about, there is no such thing as a
function with no args.  A function is closer to a mathematical function,
i.e. a mapping from one type to another, so every function has an arg.
Haskell and ML do have a "Unit" type, written "()", which is something
like Python's "None".  So in Haskell you could write
 
   f () = 1

which means the function f, applied to the Unit value (), results in the
value 1.  The parens are not function-calling syntax.  () is simply a
value.  For example, you could say

   y = ()
   z = f y

which would mean that z = 1.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to