Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

Ian Kelly ian.g.kelly at gmail.com
Wed Dec 21 12:54:40 EST 2011


On Tue, Dec 20, 2011 at 12:45 PM, Nathan Rice
<nathan.alexander.rice at gmail.com> wrote:
> Elementwise provides a proxy object for iterables which supports
> chained method calls, as well as elementwise expressions and some
> built-in functions.

It doesn't seem to work correctly when both operands are Elementwise:

>>> numerator = ElementwiseProxy(range(5))
>>> denominator = ElementwiseProxy([2, 2, 3, 3, 3])
>>> remainder = numerator % denominator
>>> print remainder
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "elementwise.py", line 72, in __repr__
    return ", ".join(e.__repr__() for e in
object.__getattribute__(self, "iterable"))
TypeError: sequence item 0: expected string, ElementwiseProxy found
>>> list(remainder)
[]

Cheers,
Ian



More information about the Python-list mailing list