"Gregory Ewing" <greg.ew...@canterbury.ac.nz> wrote in message
news:95ntrifod...@mid.individual.net...
> Tim Roberts wrote:
>> Andre Majorel <che...@halliburton.com> wrote:
>>
>>>Anyway, it seems the Python way to declare a function is
>>>
>>> def f ():
>>> pass
>>
>> No, that DEFINES a function.
>
> Actually, it's more illuminating to say that it *creates* a function.
>
> The 'def' statement in Python is an executable statement. Executing
> it has the effect of creating a function object and binding it to
> the indicated name. Before that has happened, attempting to execute
> any code referring to that name will fail.
>
> Conversely, the function name doesn't need to be bound until the
> code referring to it is actually executed. So...
>
>> def g():
>> return f()
>> def f():
>> return 3
>> print g()
>
> works because by the time g is *called*, both def statements
> have been executed, and both function names have therefore been
> bound.
>
> --
> Greg
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
Hello folks - I understand all of the above (well I suppose intuitively based
on the below) but had a longtime question and this is an opportunity to ask. I
have a B.A. in Linguistics and there was a topic they teach 'binding theory'.
This was taught in the graduate classes or some that I didn't take. I will bet
that these things are related - binding theory and this tossing around of words
in software development like 'bound' and 'binding them'. So I am wondering if
you learned this in Computer Science or Computer Engineering?, on the job? Is
there a different theory in Computer Science than I would find in linguistics?
OK - so I just grabbed one of my semantics books and found one thing in the
index 'bound occurence of a reference in a formula', doesn't really help. It
is in the Predicate Logic section and just used while he is trying to explain
something else, used in context.
Thanks
Patty
--
http://mail.python.org/mailman/listinfo/python-list