PEP 255: Simple Generators

Roman Suzi rnd at onego.ru
Thu Jun 21 11:01:20 EDT 2001


On Thu, 21 Jun 2001, Guido van Rossum wrote:

>Roman Suzi <rnd at onego.ru> writes:
>
>> I've not been heard or commented. It seems that everybody is happy with
>> simple generators (and discuss syntax) while I am not.
>>
>> I dare think that proposed gen/generator/def-yield thing is doomed to be
>> phased out in some future Python version, because it creates frozen
>> context for very narrow task of providing generators and in the future (I
>> hope) there will be normal parallel programming in Python, which will
>> solve the problem simply and efficiently.
>>
>> I am not against PEP 255. The feature is cool. But it is a feature which
>> requires new keyword, new function class, etc. In one way or another, it
>> modifies function and it implicitely lead to the same syntax beasts
>> as in C++/Java/Pascal.
>>
>> PEP 255 is not Pythonish enough.
>
>To the contrary, PDP 255 is very Pythonic: it doesn't try to provide
>the theoretically "best" solution, it provides something that is just
>as usable in most cases and much easier to implement.  This is the
>essence of many of Python's "innovations" over languages like C++ or
>Lisp.

OK... It's my bad habit to overdesign raised it's head again.

>Some "Zen of Python" (http://www.python.org/doc/Humor.html#zen) rules
>that apply to the situation:
>
>- Simple is better than complex.
>- Practicality beats purity.
>- Now is better than never.
>- If the implementation is easy to explain, it may be a good idea.

:-)

>(The importance of the latter becomes clear to anyone who has had a
>look at Neil Schemenauer's code for generators.)
>
>> Let's better think about more general things like:
>> * co-routines (which "generator" is an example, if I understand it
>> correctly)
>> * adding parallel programming paradigm (which is even better
>> for long term), where objects live their lifes and could serve
>> other objects as generators, gatherers, services, etc.
>>
>> OOP was made easy by python. I hope parallel programming
>> to be added and made equally easy, without all those
>> modifiers and zillion of new keywords and modifiers.
>>
>> Sincerely yours, Roman A.Suzi
>
>I personally don't believe that parallel programming will ever become
>the most common way of programming.  I know that *my* mind boggles as

Mine too. That is why I want Python to have it, as
always, in non-complicated form ;-)

>soon as I try to figure out what a piece of code that uses parallel
>programming features does, so I expect the same is true for, oh, 99%
>of the programmers.

I agree with the "Practicality beats purity." applied in this case.

Sincerely yours, Roman Suzi
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Thursday, June 21, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "Useless Invention: Motorcycle seat-belts." _/





More information about the Python-list mailing list