generator/coroutine terminology

Rustom Mody rustompmody at gmail.com
Sat Mar 14 12:33:59 EDT 2015


On Saturday, March 14, 2015 at 9:45:10 PM UTC+5:30, Chris Angelico wrote:
> On Sun, Mar 15, 2015 at 2:59 AM, Rustom Mody 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.)

With due respect Chris, you are confused:

Sure any effective *pythonista* (who writes useful python) will have this concept.

Python (as against pythonistas) has no such concept¹ as "function that ALWAYS
returns None"

Consider this foo

>>> def foo(x):
...  if x>0: return x-1
... 
>>> foo(3)
2
>>> foo(-1)
>>>

As best as I can see python makes no distinction between such a foo and 
the more usual function/methods that have no returns.
You can I can talk about these and distinguish them
Python has no clue about it.


----------------
Leaving aside latest type-annotation proposal.



More information about the Python-list mailing list