generator/coroutine terminology

Chris Angelico rosuav at gmail.com
Sat Mar 14 12:14:35 EDT 2015


On Sun, Mar 15, 2015 at 2:59 AM, Rustom Mody <rustompmody at gmail.com> wrote:
> Causing all sorts of unnecessary confusions:
> An int-function returns int and a char*-functions returns char*.
> Does a void-function return void??
> No a void function doesn't return anything!
> Ah So a void function does a longjmp?
>
> All of which is to say that in retrospect we need (at least in imperative programming) procedures and functions.
>
> Best if the language supports them

Python has a broad concept of "functions/methods that return something
interesting" and "functions/methods that always return None". (The
distinction often corresponds to non-mutator and mutator methods, but
that's just convention.)

Pike has void and non-void functions, but you can sometimes trick the
system into giving you the return value of a void function. (Spoiler:
It'll be the integer 0.)

HTTP has some responses which contain no body (eg 304 NOT MODIFIED) as
well as many which do.

Ditto many other languages and protocols.

In each case, there's no _real_ distinction between functions and
procedures (Pike follows C in having "void functions", but they're
still functions), and I don't see any evidence indicating that this
has damaged the languages or protocols concerned - can you show
otherwise?

ChrisA



More information about the Python-list mailing list