[julia-users] Re: multiple dispatch for operators

2016-10-08 Thread Sisyphuss
The multiplication maybe is not the best example. Actually, I wanted to say "addition". I wanted that my operator `+` works for: 1) np.ndarray + np.ndarray 2) np.ndarray + LRmatrix 3) LRmatrix + np.ndarray 4) LRmatrix + LRmatrix 1) is a part of Numpy. 3) and 4) can be implemented by

[julia-users] Re: multiple dispatch for operators

2016-10-08 Thread Sisyphuss
You mean: def mydot(A,B): if isinstance(A, np.ndarray) and isinstance(B, np.ndarray): return np.dot(A, B) else: # mycode ? Maybe you are right. Since I can't overload `np.dot`, maybe the neater way is to write a higher level function and then delegate the work by

Re: [julia-users] Re: multiple dispatch for operators

2016-10-08 Thread Sisyphuss
No, no, no, I am expert of neither language. I sincerely want to learn the difference between these 2 languages. This will help me better understand both Python and Julia. On Friday, October 7, 2016 at 9:41:43 PM UTC+2, Stefan Karpinski wrote: > > I think you're asking on the wrong list :P > >

Re: [julia-users] Re: multiple dispatch for operators

2016-10-07 Thread Stefan Karpinski
I think you're asking on the wrong list :P On Fri, Oct 7, 2016 at 1:56 PM, Gabriel Gellner wrote: > Any reason to not just use a function? (like np.dot etc) > > My understanding is that in python '*' means elementwise multiplication, > so even if you could monkeypatch

[julia-users] Re: multiple dispatch for operators

2016-10-07 Thread Gabriel Gellner
Any reason to not just use a function? (like np.dot etc) My understanding is that in python '*' means elementwise multiplication, so even if you could monkeypatch numpys __mul__ method to do the right thing wouldn't you be changing the semantics? Gabriel On Friday, October 7, 2016 at 3:51:11

[julia-users] Re: multiple dispatch for operators

2016-10-07 Thread Jeffrey Sarnoff
Is there a way around the nonjuliance of Python within Python? Regards, Jeffrey On Friday, October 7, 2016 at 5:51:11 AM UTC-4, Sisyphuss wrote: > > In Julia,