Thibaut Horel <thibaut.ho...@gmail.com> added the comment:

> this hasn't proven to be a point of confusion

Absence of evidence is not evidence of absence… The word "confusion" is 
probably a bit strong, but I recently had to write code relying on this 
behavior and found myself checking the documentation to make sure the code 
would behave as I expected. Not being able to find it explained in the 
documentation, I felt uncomfortable relying on an implicit behavior. After all, 
doesn't the PEP 20 state that "Explicit is better than implicit"?

> In the context of map() however this technique is rarely, if ever, used.

I think use cases are more common than what might appear at first glance. For 
example, a file could contain information about a list of entities, each entity 
being described over two consecutive lines of the file (this is admittedly a 
bad format for a file, but such is the reality of real-world data…). Then, 
given a function `parse` constructing an internal representation of the entity 
from two lines, the list of entities can elegantly be constructed using 
`map(parse, file, file)`. The equivalent construction with `zip` would be 
something like `starmap(parse, zip(file, file))` which is unnecessary 
convoluted.

> the pure python code provided is likely only intelligible to someone who 
> already understands map()

The pure Python code expresses `map` in terms of other language constructs, so 
it is not clear to me why one would need to already understand `map()` to 
understand the provided code. This is similar to a dictionary definition, where 
a concept is explained in terms of other concepts. This is also similar to how 
related functions (like `starmap`) are explained in the `itertools` module.

Overall, I am curious about the rationale behind not making the documentation 
more explicit when possible.

----------

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

Reply via email to