Re: [Numpy-discussion] New Operators in Python

2007-03-26 Thread tan2
On 3/26/07, René Bastian <[EMAIL PROTECTED]> wrote: May be it would be possible to implement a class with user "definissable" (?) signs. Yes, it is possible and is done. See this recipe to define an Infix operator class either: x |op| y or: x <> y http://aspn.activestate.com/ASPN/Cookbook/

Re: [Numpy-discussion] New Operators in Python

2007-03-26 Thread Beliavsky
On Mar 24, 3:48 pm, "Charles R Harris" <[EMAIL PROTECTED]> wrote: > > It is somewhat workable as it stands, but I think it would be nicer if > > we could have some "meta" operator that allowed an alternative > > definition of major operators. Something like @* for example (just > > picking a ch

Re: [Numpy-discussion] New Operators in Python

2007-03-26 Thread Steven H. Rogers
Zachary Pincus wrote: > > Anyhow, feel free to disagree with me -- I'm no expert here. I'm only > mentioning this as a public service to make it clear that most of > what's being proposed in this thread is, for better or worse, 100% > dead-in-the-water for Python 3, and the rest will have a

Re: [Numpy-discussion] New Operators in Python

2007-03-26 Thread Zachary Pincus
Hi folks, Sorry to rain on this parade, but unicode variable names and/or other syntactic elements have already been rejected for Python 3: http://www.python.org/dev/peps/pep-3099/ > Python 3000 source code won't use non-ASCII Unicode characters for > anything except string literals or commen

Re: [Numpy-discussion] New Operators in Python

2007-03-26 Thread dmitrey
The unicode keyboards sailing everywhere is just a matter of time And python 2-symbol operators soon will look obsolete, this will increase migrating from python to Sun fortress etc. I took a look at their unicode syntax for math formulas http://research.sun.com/projects/plrg/faq/NAS-CG.pdf it lo

Re: [Numpy-discussion] New Operators in Python

2007-03-26 Thread René Bastian
Hello, I am interest both in numarray type multiplication and matrix type multiplication. But I am not shure that I can buy an Unicode keyboard. May be it would be possible to implement a class with user "definissable" (?) signs. My choice : a * b -> numarray type multi a !* b -> matrix --

Re: [Numpy-discussion] New Operators in Python

2007-03-25 Thread dmitrey
Hallo! 1)Isn't it possible to add .A & .M attributes to the array & matrix instances? I would find them very useful for some cases more convenient than asarray() or mat(). Let x.A just do nothing if x is array and x.M do nothing if x i matrix. 2)And if y=flat(x), what about y.R and y.C for to

Re: [Numpy-discussion] New Operators in Python

2007-03-25 Thread Bill Baxter
On 3/26/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > > What might work better is simply some sort of sign that causes a function to > be parsed as infix, x @dot y for instance, although Python already uses @ > for other things. I don't know what symbols are left unused at this point, > maybe !

Re: [Numpy-discussion] New Operators in Python

2007-03-25 Thread Steven H. Rogers
Bill Baxter wrote: > > Until we get to the point that it's actually harder to find a > non-Unicode console/editor than a Unicode one, I think the idea of > using Unicode symbols as part of the syntax of a general purpose > language is a bad one. Given that most editors lack good Unicode support,

Re: [Numpy-discussion] New Operators in Python

2007-03-25 Thread Charles R Harris
On 3/25/07, Bill Baxter <[EMAIL PROTECTED]> wrote: On 3/26/07, Steven H. Rogers <[EMAIL PROTECTED]> wrote: > Joe Harrington wrote: > > > > On the other hand, Python, IDL, and Matlab are attractive to us mainly > > because their syntaxes allow us to see the math, understand it on > > inspection,

Re: [Numpy-discussion] New Operators in Python

2007-03-25 Thread Bill Baxter
On 3/26/07, Steven H. Rogers <[EMAIL PROTECTED]> wrote: > Joe Harrington wrote: > > > > On the other hand, Python, IDL, and Matlab are attractive to us mainly > > because their syntaxes allow us to see the math, understand it on > > inspection, and verify its correctness. The math we write in thes

Re: [Numpy-discussion] New Operators in Python

2007-03-25 Thread Steven H. Rogers
Joe Harrington wrote: > > On the other hand, Python, IDL, and Matlab are attractive to us mainly > because their syntaxes allow us to see the math, understand it on > inspection, and verify its correctness. The math we write in these > languages looks as much like the math we do on paper as ASCII

Re: [Numpy-discussion] New Operators in Python

2007-03-25 Thread Joe Harrington
I strongly agree with the need for different infix operators for matrix and array multiplication. In IDL, I have used both in the same code. IDL uses * for array and # for matrix (hey, # even *looks* like a matrix, very intuitive). It uses ## for right-multiply (why people don't just M-t the var

Re: [Numpy-discussion] New Operators in Python

2007-03-25 Thread Alan G Isaac
On Sun, 25 Mar 2007, Paulo Jose da Silva e Silva apparently wrote: > Even though I can get used with using dot (or > matrixmultiply) to do it, I can easily see the benefit of > having a special operator here. Some newer languages are taking advantage of the expressiveness of Unicode for math

Re: [Numpy-discussion] New Operators in Python

2007-03-25 Thread Paulo Jose da Silva e Silva
Em Seg, 2007-03-26 às 01:08 +1000, dpn escreveu: > With the possible inclusion of generic functions in py3k I dont really > see the point of adding more operators. (While i do miss mat1 x mat2 > from PDL). > > mat3 = mat1.mm(mat2) or the like seems to be sufficient. > > I find matrix multiplicati

Re: [Numpy-discussion] New Operators in Python

2007-03-25 Thread dpn
With the possible inclusion of generic functions in py3k I dont really see the point of adding more operators. (While i do miss mat1 x mat2 from PDL). mat3 = mat1.mm(mat2) or the like seems to be sufficient. I find matrix multiplication annoying in the case of SVD reconstruction: final = matrixm

Re: [Numpy-discussion] New Operators in Python

2007-03-25 Thread Colin J. Williams
Charles R Harris wrote: > > > On 3/24/07, *Travis Oliphant* <[EMAIL PROTECTED] > > wrote: > > Every so often the idea of new operators comes up because of the need to > do both "matrix-multiplication" and element-by-element multiplication. > > I think this

Re: [Numpy-discussion] New Operators in Python

2007-03-24 Thread Anne Archibald
On 24/03/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > Yes indeed, this is an old complaint. Just having an infix operator would be > an improvement: > > A dot B dot C > > Not that I am suggesting dot in this regard ;) In particular, it wouldn't > parse without spaces. What about division? Mat

Re: [Numpy-discussion] New Operators in Python

2007-03-24 Thread Sebastian Haase
On 3/24/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > On 3/24/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > Every so often the idea of new operators comes up because of the need to > > do both "matrix-multiplication" and element-by-element multiplication. > > > > I think this is one ar

Re: [Numpy-discussion] New Operators in Python

2007-03-24 Thread Charles R Harris
On 3/24/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: Every so often the idea of new operators comes up because of the need to do both "matrix-multiplication" and element-by-element multiplication. I think this is one area where the current Python approach is not as nice because we have a limi

Re: [Numpy-discussion] New Operators in Python

2007-03-24 Thread Matthieu Brucher
Hi, I followed the discussion on the scipy ML, and I would advocate it as well. I miss the dichotomy that is present in Matlab, and to have a similar degree of freedom, it would be good to have it in the upcoming major release of Python. Matthieu 2007/3/24, Travis Oliphant <[EMAIL PROTECTED]>:

[Numpy-discussion] New Operators in Python

2007-03-24 Thread Travis Oliphant
Every so often the idea of new operators comes up because of the need to do both "matrix-multiplication" and element-by-element multiplication. I think this is one area where the current Python approach is not as nice because we have a limited set of operators to work with. One thing I wonder i