generator/coroutine terminology

Mark Lawrence breamoreboy at yahoo.co.uk
Mon Mar 16 23:07:07 EDT 2015


On 17/03/2015 02:52, Rustom Mody wrote:
> On Monday, March 16, 2015 at 11:50:33 PM UTC+5:30, Mark Lawrence wrote:
>> On 16/03/2015 14:37, Rustom Mody wrote:
>>> On Monday, March 16, 2015 at 7:57:08 PM UTC+5:30, Mark Lawrence wrote:
>>>> On 16/03/2015 14:19, Rustom Mody wrote:
>>>>> ======================
>>>>> Anyways...
>>>>>
>>>>> Yes 15 years are past.
>>>>> I dont expect the def can be revoked now.
>>>>> [As far as I am concerned its a minor wart]
>>>>> But the mess around the docs can certainly be cleaned up.
>>>>>
>>>>
>>>> So write the patches to correct the docs, then raise the issue on the
>>>> bug tracker to get the patches accepted.  IIRC for doc patches you don't
>>>> even have to provide diff files against the rst files, plain text will
>>>> do, the core devs will do the rest for you.
>>>
>>> I would gladly do that if it was a minor correction here and there.
>>> But the problem is a bit deeper even though it can be kept mostly¹ in the docs
>>> and not modify any syntax/semantics of python.
>>>
>>> In particular for:
>>>
>>> def potato(x):
>>>     yield x+1
>>>
>>> tomato = potato(3)
>>>
>>> what shall we call potato and tomato.
>>> I believe this thread clearly shows that the docs are confused and inconsistent.
>>> Yet I dont see any consensus on what/how to classify tomato/potato.
>>>
>>> Function -- trouble on one side
>>> Generator -- trouble on another
>>> Iterator -- trouble on third
>>> etc
>>>
>>> ¹ Grey areas excepted eg output of help(); inspect module etc
>>>
>>
>> So the docs are confused and inconsistent but in an open source
>> community it's not *MY* responsibility to deal with it, somebody else can.
>>
>> Making mountains out of mole hills is all I see in this entire thread.
>
> Ok... Lets see... What if any agreement is there on this.
>
> To start with basic terminology. Given
>
>> def potato(x):
>>     yield x+1
>>
>> tomato = potato(3)
>>
>> What shall we call potato and tomato?
>
> Steven suggested that potato can be called 'factory'
> Not ideal, but way better than 'generator-function'.
> Oscar does not like it.
> No better/other suggestions (that we see here).
>
> What next?
>
> Ok Let me throw out a suggestion:
>   - potato is a generator
>   - tomato is a cursor.
> Acceptable?
>

No.  In Python potato is a generator function, tomato is a generator. 
Why complicate something that is so simple?  I couldn't care less what 
they are called in any other language.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list