On 16/03/2015 14:19, Rustom Mody wrote:
On Monday, March 16, 2015 at 7:10:03 PM UTC+5:30, Steven D'Aprano wrote:
And of course, from a comp science theoretic perspective,
generators are a kind of subroutine, not a kind of type.

You just showed Marko a few posts back, that
A generator is a special case of an iterator.
And you wrote the iterator with 'class'.
And from python 2.2(?) classes are types.

So I dont know what "comp science theoretic perspective" you are describing...

 From mine:

The generator
def gen():
   yield 1
   yield 2

is much closer to the list (ie data) [1,2]
than to say

def foo():
   print 1
   print 2

The only difference is that the list memoizes the data whereas the generator 
doesn't.

CLU perspective:
The iterator for a collection of complex_numbers can be used interchangeably 
with that for an array of integers
from https://en.wikipedia.org/wiki/CLU_%28programming_language%29
[Note: CLU-iterator ≡ python-generator]

Haskell perspective:
Lists are by default lazy and memoized.
IOW in Haskell: List ≡ Lazy list ≡ python generator + memoization

Scheme perspective:
Programmer can choose between normal and lazy lists.
Lazy lists are just normal lists + delay/force where
delay x ≡ lambda: x
force x ≡ x()

======================
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.

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

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to