Abbas Taher <altaher_ab...@yahoo.com> added the comment:

Good morning Raymond,   Thank you for this quick response.
You are absolutely right on all your points if you only consider that the 
example given in the documentation as purely a suggestion of "equivalent" 
version to the one implemented in the library.
However, if you look at the examples given in the documentation as an 
illustration of an algorithm that can be customized and changed by the end-user 
if the existing implementation is not suitable then you might consider 
otherwise. 
This is exactly what happened when I wanted to do a Cartesian Product. 
Starting, I first looked at itertools and 
run my routine using itertools.product(). However, it turns out that I needed 
to flatten the result tuples which prompted me toadjust the given example 
accordingly and then add the nested generator.

As for your statement:  "Nested generators are an intermediate level Python 
skill, so using them in the example code makes the docs less accessible.". Let 
me point to the facts, that someone looking at itertools and trying to do a 
Cartesian Product 
is certainly an intermediate programmer and often likes to understand, learn or 
peek inside the algorithm used. Additionally, the suggested improvement is a 
generator similar to the implementation where as the existing example is not.

Thus, I hope I am able to convince you to reconsider your decision especially 
when you look at the given examples from a wider perspective and more so when 
the suggested improvement is minor and easy to understand.
Best Regards,
Abbas

Side note: one of the first tutorial videos I used to learn Python were the 
ones you prepared for Oreilly. Thank you and thank you for all the work you did 
and still doing for free for the Python language and the Python community over 
so many many many years.

    On Thursday, June 25, 2020, 9:19:55 PM EDT, Raymond Hettinger 
<rep...@bugs.python.org> wrote:  

Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

Thanks for the suggestion, but the purpose of the rough equivalent example is 
to give a better idea of what product() does.  It is not about performance — 
that job falls to the actual implementation.

Nested generators are an intermediate level Python skill, so using them in the 
example code makes the docs less accessible.

----------
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41120>
_______________________________________

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41120>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to