generator/coroutine terminology

Albert van der Horst albert at spenarnc.xs4all.nl
Tue Mar 31 08:57:35 EDT 2015


In article <83d579c1-ab61-4a3d-a834-e65d28eace8a at googlegroups.com>,
Rustom Mody  <rustompmody at gmail.com> wrote:
>On Saturday, March 14, 2015 at 8:59:22 PM UTC+5:30, Rustom Mody wrote:
>> On Saturday, March 14, 2015 at 11:34:27 AM UTC+5:30, Steven D'Aprano wrote:
>> >
>> > A generator (function) may be a function which returns an iterator,...
>>
>> I find "generator-function" misleading in the same way that "pineapple"
>> misleadingly suggests "apple that grows on pines"
>>
>> A builtin function is a function in the builtin (or builtins -- can
>never remember) module
>> A pure function is function that does not assign or mutate non-locals
>> A Steven-function is a function that presumably Steven wrote
>>
>> However a "generator function" is a weird sort of function (at best).
>> Not regarding it as a function is IMO more reasonable.
>
>Another analogy somewhat closer home than pineapples.
>In Pascal there are procedures and functions.
>Even in the venerable Fortran there are subroutine-subprogram and
>(sub)function-subprogram.

The Algol 68 designers considered it a defect in the design.
They created a situation like in Python, where a "def"-thingy need
not return a value.

>
>C took the stupid approach of just throwing out one of these.
>A decade of troubles was enough to convince people that it was needed and the
>mysterious 'void-returning' function was introduced to simulate procedures

The mistake this was intended to fix, was the rule that by default a
function returns int in C.

Groetjes Albert
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert at spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst




More information about the Python-list mailing list