Re: user-defined operators: a very modest proposal

2005-11-24 Thread Antoon Pardon
Op 2005-11-22, [EMAIL PROTECTED] schreef <[EMAIL PROTECTED]>: > * Should some of the unicode mathematical symbols be reserved for > literals? > It would be greatly preferable to write \u2205 instead of the other > proposed > empty-set literal notation, {-}. Perhaps nullary operat

Re: user-defined operators: a very modest proposal

2005-11-23 Thread Kay Schluehr
Steve R. Hastings wrote: > It should be possible to define operators using punctuation, > alphanumerics, or both: > > ]+[ > ]add[ > ]outer*[ Seems like you look for advanced source-code editors.Some ideas are around for quite a while e.g. here http://en.wikipedia.org/wiki/Intentional_programming

Re: user-defined operators: a very modest proposal

2005-11-23 Thread bruno at modulix
Joseph Garvin wrote: > Tom Anderson wrote: > >> Jeff Epler's proposal to use unicode operators would synergise most >> excellently with this, allowing python to finally reach, and even >> surpass, the level of expressiveness found in languages such as perl, >> APL and INTERCAL. s/expressiveness/u

Re: user-defined operators: a very modest proposal

2005-11-23 Thread Simon Brunning
On 23/11/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > see also: > > http://www.brunningonline.net/simon/blog/archives/000666.html > http://www.python.org/peps/pep-0666.html PEP 666 should have been left open. There are a number of ideas that come up here that should be added to it - and

Re: user-defined operators: a very modest proposal

2005-11-23 Thread Fredrik Lundh
Simon Brunning wrote: >> What do you mean by unicode operators? Link? > > http://fishbowl.pastiche.org/2003/03/19/jsr666_extended_operator_set see also: http://www.brunningonline.net/simon/blog/archives/000666.html http://www.python.org/peps/pep-0666.html -- http://mail.python.org/

Re: user-defined operators: a very modest proposal

2005-11-23 Thread Simon Brunning
On 23/11/05, Joseph Garvin <[EMAIL PROTECTED]> wrote: > What do you mean by unicode operators? Link? http://fishbowl.pastiche.org/2003/03/19/jsr666_extended_operator_set -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/py

Re: user-defined operators: a very modest proposal

2005-11-23 Thread Fredrik Lundh
Joseph Garvin wrote: > >Jeff Epler's proposal to use unicode operators would synergise most > >excellently with this, allowing python to finally reach, and even surpass, > >the level of expressiveness found in languages such as perl, APL and > >INTERCAL. > > > What do you mean by unicode operators

Re: user-defined operators: a very modest proposal

2005-11-22 Thread Tom Anderson
On Tue, 22 Nov 2005 [EMAIL PROTECTED] wrote: > Each unicode character in the class 'Sm' (Symbol, > Math) whose value is greater than 127 may be used as a user-defined operator. EXCELLENT idea, Jeff! > Also, to accomodate operators such as u'\N{DOUBLE INTEGRAL}', which are not > simple unary or b

Re: user-defined operators: a very modest proposal

2005-11-22 Thread Joseph Garvin
Tom Anderson wrote: >Jeff Epler's proposal to use unicode operators would synergise most >excellently with this, allowing python to finally reach, and even surpass, >the level of expressiveness found in languages such as perl, APL and >INTERCAL. > >tom > > > What do you mean by unicode operat

Re: user-defined operators: a very modest proposal

2005-11-22 Thread Tom Anderson
On Tue, 22 Nov 2005, Steve R. Hastings wrote: > User-defined operators could be defined like the following: ]+[ Eeek. That really doesn't look right. Could you remind me of the reason we can't say [+]? It seems to me that an operator can never be a legal filling for an array literal or a subscr

Re: user-defined operators: a very modest proposal

2005-11-22 Thread jepler
On Tue, Nov 22, 2005 at 04:08:41PM -0800, Steve R. Hastings wrote: > Actually, that's a better syntax than the one I proposed, too: > > __+__ > # __add__ # this one's already in use, so not allowed > __outer*__ Again, this means something already. >>> __ = 3 >>> __+__ 6 >>> __outer = 'x' >>>

Re: user-defined operators: a very modest proposal

2005-11-22 Thread Steve R. Hastings
> if [1,2]+[3,4] != [1,2,3,4]: raise TestFailed, 'list concatenation' > Since it contains ']+[' I assume it must now be parsed as a user-defined > operator, but this code currently has a meaning in Python. Yes. I agree that this is a fatal flaw in my suggestion. Perhaps there is no syntax

Re: user-defined operators: a very modest proposal

2005-11-22 Thread Steve R. Hastings
> Here is a thought: Python already supports an unlimited number of > operators, if you write them in prefix notation: And indeed, so far Python hasn't added user-defined operators because this has been adequate. > Here is some syntax that I don't object to, although that's not saying > much. >

Re: user-defined operators: a very modest proposal

2005-11-22 Thread Mike Meyer
"Steve R. Hastings" <[EMAIL PROTECTED]> writes: > I have been studying Python recently, and I read a comment on one > web page that said something like "the people using Python for heavy math > really wish they could define their own operators". The specific > example was to define an "outer prod

Re: user-defined operators: a very modest proposal

2005-11-22 Thread Dan Bishop
Steve R. Hastings wrote: > I have been studying Python recently, and I read a comment on one > web page that said something like "the people using Python for heavy math > really wish they could define their own operators". The specific > example was to define an "outer product" operator for matric

Re: user-defined operators: a very modest proposal

2005-11-22 Thread jepler
If your proposal is implemented, what does this code mean? if [1,2]+[3,4] != [1,2,3,4]: raise TestFailed, 'list concatenation' Since it contains ']+[' I assume it must now be parsed as a user-defined operator, but this code currently has a meaning in Python. (This code is the first example

Re: user-defined operators: a very modest proposal

2005-11-22 Thread Steven D'Aprano
On Tue, 22 Nov 2005 13:48:05 -0800, Steve R. Hastings wrote: > User-defined operators could be defined like the following: ]+[ [snip] > Examples of use: > > m = m0 ]*[ m1 > m = m0]*[m1 That looks to me like multiplying two lists. I have to look twice to see that the operands are merely m0 and