Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.
Nathan Rice
nathan.alexander.rice at gmail.com
Wed Dec 21 14:04:16 EST 2011
On Wed, Dec 21, 2011 at 1:41 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
>
> I expected the equivalent of:
>
> remainder = [n % d for (n, d) in zip(numerator, denominator)]
>
> which is what numpy does.
I do want to come up with a nice way to do that... However:
if numerator and denominator are plain lists that magically have an
each method...
each_numerator = numerator.each
each_denominator = denominator.each
each_numerator % each_denominator
see where I'm going with the mismatch on the semantics? I know the
example is a bit contrived, sorry.
Expanding iterators by default might be a worth a shot though, since
passing around iterators like that is pretty rare.
Nathan
More information about the Python-list
mailing list