<div class="gmail_quote">On 21 December 2011 18:32, Nathan Rice <span dir="ltr"><<a href="mailto:nathan.alexander.rice@gmail.com">nathan.alexander.rice@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im">On Wed, Dec 21, 2011 at 1:24 PM, Joshua Landau<br>
<<a href="mailto:joshua.landau.ws@gmail.com">joshua.landau.ws@gmail.com</a>> wrote:<br>
> I was under the impression that these were meant to be interchangeable. This<br>
> is because functions are just wrappers to non-functions, really.<br>
><br>
>>>> from elementwise import ElementwiseProxy as P<br>
>>>> (lambda x:x+[1])(P([[0],[0],[0]]))<br>
> [0, 1], [0, 1], [0, 1]<br>
><br>
> If we have to use .apply, we might as well use map :P.<br>
<br>
</div>Apply is not required, you can use functions.  I just hate reading<br>
inside out and backwards.  compare:<br>
<br>
func3(func2(func1(x))) # Fine if the chain is short, but quickly gets unreadable<br>
<br>
x.apply(func1).apply(func2).apply(func3) # More verbose when working<br>
with short chains, but infinitely clearer and more readable when<br>
things start getting complicated, or for less experienced coders</blockquote><div><br></div><div>I wan't disagreeing with that, hence the word "if". I was just making a counter-counter point to a misunderstanding of my post.</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
> Note that "len" and "dir" crash.<br>
><br>
> Here is a perfect example:<br>
>>>> int(P(["1","2","3"]))<br>
> Traceback (most recent call last):<br>
>   File "<stdin>", line 1, in <module><br>
> TypeError: __int__ returned non-int (type ElementwiseProxy)<br>
<br>
</div>It is alpha software :P  Easily fixed though.<font color="#888888"><br></font></blockquote></div><br><div>If fix means "return number" then no. This inconsistency between elementwise operations and 'normal' ones is the problem. Again, explicit elementwise-ifying through "~" fixes that. You need to tell me why this is worth the confusion over that.</div>