Re: [Python-Dev] Infix operators

2008-07-27 Thread Steve Holden
Charles Hixson wrote: [...] OTOH, it seems far too late in the development process to be inserting such a change in Python 2.6 or 3.0. If this is important to you, you should probably propose it for 2.7/3.1. It's been too late for over three months now, and the suggestions I've seen so far a

Re: [Python-Dev] Infix operators

2008-07-27 Thread Lennart Regebro
On Sun, Jul 27, 2008 at 19:43, Charles Hixson <[EMAIL PROTECTED]> wrote: > Therefore it seems to me that the appropriate thing is to create a convention > that bar-somethingprintable-bar And the "something-printable" shows the main flaw of this approach. Mathematics indeed uses a lot of symbols to

Re: [Python-Dev] Infix operators

2008-07-27 Thread Charles Hixson
On Saturday 26 July 2008 01:23:17 am Nick Coghlan wrote: > Sebastien Loisel wrote: > > However, just for posterity (and I'm not going to pursue the argument > > further than this), I'll say this. The problem of determining the > > meaning (or overridability or whatever) of x=4$6 is the same as the

Re: [Python-Dev] Infix operators

2008-07-26 Thread Nick Coghlan
Sebastien Loisel wrote: However, just for posterity (and I'm not going to pursue the argument further than this), I'll say this. The problem of determining the meaning (or overridability or whatever) of x=4$6 is the same as the problem of determining the meaning of x=fooz(4,6). Since it's not a

Re: [Python-Dev] Infix operators

2008-07-24 Thread Greg Ewing
Josiah Carlson wrote: This is the first time anyone has mentioned "conciseness" in this thread. I thought it more or less went without saying. After all, if conciseness isn't a goal, there's nothing wrong with a plain function call, which can be as short as 3 characters as well. The trouble i

Re: [Python-Dev] Infix operators

2008-07-24 Thread Greg Ewing
Scott Dial wrote: I would argue that Python contains a "array of some_type" data type. That sum() performs a left-fold of __add__ on the array is completely independent of them being numbers. That's not strictly true -- it explicitly refuses to operate on strings (or at least it did last time

Re: [Python-Dev] Infix operators

2008-07-24 Thread Josiah Carlson
On Thu, Jul 24, 2008 at 7:08 PM, Greg Ewing <[EMAIL PROTECTED]> wrote: > Fredrik Johansson wrote: > >> Anyway, it is easy to define pseudo-operators in Python; >> >> A *matrixmul* B >> A *dot* B >> A *cross* B >> A *elementwise* B > > Urg. This is another one of those recipes that I consider > is t

Re: [Python-Dev] Infix operators

2008-07-24 Thread Scott Dial
Greg Ewing wrote: Scott Dial wrote: Perhaps I'm nobody, but I think this would be ridiculous. Matrices are not native objects to the language. Why should that matter? We already have things like sum(), which operates on any sequence of numbers, without needing a special "array of numbers" data

Re: [Python-Dev] Infix operators

2008-07-24 Thread Greg Ewing
Fredrik Johansson wrote: Anyway, it is easy to define pseudo-operators in Python; A *matrixmul* B A *dot* B A *cross* B A *elementwise* B Urg. This is another one of those recipes that I consider is too clever for its own good. Very nice in theory, but I would never use it in real life. What

Re: [Python-Dev] Infix operators

2008-07-24 Thread Greg Ewing
Scott Dial wrote: Perhaps I'm nobody, but I think this would be ridiculous. Matrices are not native objects to the language. Why should that matter? We already have things like sum(), which operates on any sequence of numbers, without needing a special "array of numbers" data type. I don't see

Re: [Python-Dev] Infix operators

2008-07-24 Thread Fredrik Johansson
On Fri, Jul 25, 2008 at 12:06 AM, Scott Dial <[EMAIL PROTECTED]> wrote: > Perhaps I'm nobody, but I think this would be ridiculous. Matrices are > not native objects to the language. There is no type(matrix). The notion > of what makes a Python object a matrix is a convention and to have > built-i

Re: [Python-Dev] Infix operators

2008-07-24 Thread Scott Dial
Sebastien Loisel wrote: Greg Ewing said: I would actually be in favour of adding a matrix multiplication operator That would be helpful to me, for my students as well as my papers. Perhaps I'm nobody, but I think this would be ridiculous. Matrices are not native objects to the language. The

Re: [Python-Dev] Infix operators

2008-07-24 Thread Sebastien Loisel
Greg Ewing said: > I would actually be in favour of adding a matrix multiplication > operator That would be helpful to me, for my students as well as my papers. Sincerely, -- Sébastien Loisel ___ Python-Dev mailing list Python-Dev@python.org http://ma

Re: [Python-Dev] Infix operators

2008-07-23 Thread Aahz
On Wed, Jul 23, 2008, Sebastien Loisel wrote: > > [...] I was thinking that it would be simpler to have a way > for defining new infix operators, [...] python-dev is the wrong place for this discussion. Please use either comp.lang.python or python-ideas. -- Aahz ([EMAIL PROTECTED]) <*>

Re: [Python-Dev] Infix operators

2008-07-23 Thread Greg Ewing
Josiah Carlson wrote: What the heck does 'x = 4 $ 6' mean in Python? Oh, that's right, it's a custom infix operator. But where is it defined? It's not quite as bad as that -- it would be defined by the relevant operator method on one of the operands. But a convention would be needed for mappi

Re: [Python-Dev] Infix operators

2008-07-23 Thread Sebastien Loisel
Dear Greg, Thanks for your email. Guido is on record as opposing any kind of macros > or other "extensible syntax", and this probably comes > under the same heading. > Thanks, that's exactly what I was looking for when I asked: Now since this is such a simple idea, I'm guessing it occured to py

Re: [Python-Dev] Infix operators

2008-07-23 Thread Greg Ewing
Sebastien Loisel wrote: Essentially, in almost all applications, inv(A) is entirely wrong. You can ask any numerical analyst who works with large problems, and they will confirm it. One of the main reason is that, even if A is sparse, inv(A) is full. This argues for a function such as solve(

Re: [Python-Dev] Infix operators

2008-07-23 Thread Sebastien Loisel
Dear Curt, Thank you for your email. Have you considered OCaml? (http://en.wikipedia.org/wiki/Ocaml) It's > I have. I've considered a lot of languages, but OCaml isn't for me. My current language is MATLAB. Python is pretty close in syntax, and it's widely accepted, so you can teach students Pyt

Re: [Python-Dev] Infix operators

2008-07-23 Thread Curt Hagenlocher
On Wed, Jul 23, 2008 at 4:48 PM, Sebastien Loisel <[EMAIL PROTECTED]> wrote: > > On Wed, Jul 23, 2008 at 7:11 PM, Josiah Carlson <[EMAIL PROTECTED]> > wrote: >> >> language, I would ask you if logix >> (http://www.livelogix.net/logix/intro.html) would suit you better. It >> seems to allow you to u

Re: [Python-Dev] Infix operators

2008-07-23 Thread Sebastien Loisel
Dear Josiah, Thank you for your email. On Wed, Jul 23, 2008 at 7:11 PM, Josiah Carlson <[EMAIL PROTECTED]> wrote: > What the heck does 'x = 4 $ 6' mean in Python? Oh, that's right, it's > a custom infix operator. But where is it defined? In the module? In > some other module that is imported

Re: [Python-Dev] Infix operators

2008-07-23 Thread Josiah Carlson
On Wed, Jul 23, 2008 at 2:14 PM, Sebastien Loisel <[EMAIL PROTECTED]> wrote: > Dear Pythonistas, > > I've googled for this but I wasn't able to find anything definitive. I was > recently looking at scipy to see if I could use it in stead of MATLAB for my > class on numerical PDEs, but I noticed tha

[Python-Dev] Infix operators

2008-07-23 Thread Sebastien Loisel
Dear Pythonistas, I've googled for this but I wasn't able to find anything definitive. I was recently looking at scipy to see if I could use it in stead of MATLAB for my class on numerical PDEs, but I noticed that there's some difficulty related to the notation; mainly, the matrix multiplication,