On Sun, Jun 25, 2017 at 8:23 PM, Steven D'Aprano <st...@pearwood.info>
wrote:

> On Sun, Jun 25, 2017 at 02:06:54PM +0200, lucas via Python-ideas wrote:
>
> I have a counter-proposal: introduce the iterator chaining operator "&":
>
>     iterable & iterable --> itertools.chain(iterable, iterable)
>

In [1]: import numpy as np
In [2]: import itertools
In [3]: a, b = np.array([1,2,3]), np.array([4,5,6])
In [4]: a & b
Out[4]: array([0, 0, 2])
In [5]: a + b
Out[5]: array([5, 7, 9])
In [6]: list(itertools.chain(a, b))
Out[6]: [1, 2, 3, 4, 5, 6]

These are all distinct, useful, and well-defined behaviors.

-- 
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to