<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hi!<br><br></div>Sorry if someone has already talked about it (my simple search did not show any results).<br><br></div>What do you think about adding map, flatmap, filter and reduce methods to generator type ?<br>
<br></div>I must admit I've seen and I like Java 8 notation and I think it might be more readable than Python way in a few occasions.<br><br></div><div>I would like to be able to write:<br></div><div><br></div>range(100).\<br>
filter( f1 ).\<br></div> map( f2 ).\<br></div><div> filter( f3 ).\<br></div><div> map( f4 ).\<br></div> reduce(operator.add)<br><br></div>in addition to current Pythonic way of<br></div><div><br></div>reduce( operator.add, f4(x) for x in <br>
</div><div> ( f2(y) for y in range(100) if f1(y))<br></div><div> if f3(x) )<br><br>Though longer - Java way seems to be a bit more readable as the notation follows the data flow sequence.<br></div><br></div><div>Do you think it is worth a PEP?<br>
<br></div><div>BR,<br><br></div><div>Jacek<br></div></div>