On Wed, Dec 21, 2011 at 1:24 PM, Joshua Landau <joshua.landau...@gmail.com> wrote: > I was under the impression that these were meant to be interchangeable. This > is because functions are just wrappers to non-functions, really. > >>>> from elementwise import ElementwiseProxy as P >>>> (lambda x:x+[1])(P([[0],[0],[0]])) > [0, 1], [0, 1], [0, 1] > > If we have to use .apply, we might as well use map :P.
Apply is not required, you can use functions. I just hate reading inside out and backwards. compare: func3(func2(func1(x))) # Fine if the chain is short, but quickly gets unreadable x.apply(func1).apply(func2).apply(func3) # More verbose when working with short chains, but infinitely clearer and more readable when things start getting complicated, or for less experienced coders > Note that "len" and "dir" crash. > > Here is a perfect example: >>>> int(P(["1","2","3"])) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > TypeError: __int__ returned non-int (type ElementwiseProxy) It is alpha software :P Easily fixed though. Nathan -- http://mail.python.org/mailman/listinfo/python-list