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 11:43:49 EST 2011


On Wed, Dec 21, 2011 at 11:29 AM, Robert Kern <robert.kern at gmail.com> wrote:
> On 12/21/11 3:15 PM, Nathan Rice wrote:
>
>>> Incidentally, displaying an ElementwiseProxy instance doesn't go down
>>> well with iPython:
>>>
>>> In [1]: from elementwise import *
>>>
>>> In [2]: e = ElementwiseProxy(['one','two','three'])
>>>
>>> In [3]: e
>>> Out[3]: ERROR: An unexpected error occurred while tokenizing input
>>> The following traceback may be corrupted or invalid
>>> The error message is: ('EOF in multi-line statement', (6, 0))
>>
>>
>> I love IPython, but it has had known problems with iterators for
>> years.  A long time ago, I agonized over what I thought was a bug in
>> my code where itertools.count would skip numbers in IPython, but my
>> unit tests all passed.  Everything should work fine if you tuple() it
>> first.
>
>
> This is a different problem, actually. The problem is that the recently
> added (by me, actually) pretty-printing system tries to dispatch based on
> the type. In order to handle old-style classes, it checks for the type using
> .__class__ first. ElementProxy's __getattribute__() gets in the way here by
> returning a generator instead of the ElementProxy class.

Thanks for the heads up Robert.  Given that IPython is awesome and
people should probably be doing an '.apply(type)' in that instance
anyhow, I will corner case that on __getattribute__.

Nathan



More information about the Python-list mailing list