Re: Other notes

2005-01-08 Thread beliavsky
Bengt Richter wrote: >OTOH, there is precedent in e.g. fortran (IIRC) for named operators of the >form .XX. -- e.g., .GE. for >= so maybe there could be room for both. Yes, but in Fortran 90 "==", ">=" etc. are equivalent to ".EQ." and ".GE.". It is also possible to define operators on native an

Re: Other notes

2005-01-08 Thread Bengt Richter
On Sat, 08 Jan 2005 18:22:53 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >> IOW, I think there is a fix: keep tokenizing greedily and tokenize floating >> point as >> a sequence of integers and operators, and let be >> translated by >> the compiler to floating point, an

Re: Other notes

2005-01-08 Thread Nick Coghlan
Bengt Richter wrote: IOW, I think there is a fix: keep tokenizing greedily and tokenize floating point as a sequence of integers and operators, and let be translated by the compiler to floating point, and be translated to the appropriate generator expression implementation. That would be: ->

Re: Other notes

2005-01-07 Thread Bengt Richter
On Fri, 07 Jan 2005 06:04:01 GMT, Andrew Dalke <[EMAIL PROTECTED]> wrote: >Bengt Richter: >> But it does look ahead to recognize += (i.e., it doesn't generate two >> successive also-legal tokens of '+' and '=') >> so it seems it should be a simple fix. > >But that works precisely because of the gr

Re: Other notes

2005-01-07 Thread Steve Holden
Andrew Dalke wrote: Bengt Richter: But it does look ahead to recognize += (i.e., it doesn't generate two successive also-legal tokens of '+' and '=') so it seems it should be a simple fix. But that works precisely because of the greedy nature of tokenization. Given "a+=2" the longest token it find

Re: Other notes

2005-01-06 Thread Andrew Dalke
Bengt Richter: > But it does look ahead to recognize += (i.e., it doesn't generate two > successive also-legal tokens of '+' and '=') > so it seems it should be a simple fix. But that works precisely because of the greedy nature of tokenization. Given "a+=2" the longest token it finds first is "a"

Re: Other notes

2005-01-06 Thread Bengt Richter
On Thu, 06 Jan 2005 19:24:52 GMT, Andrew Dalke <[EMAIL PROTECTED]> wrote: >Me > (BTW, it needs to be 1 .. 12 not 1..12 because 1. will be interpreted > as the floating point value "1.0".)< > >Steve Holden: >> Indeed, but if ".." is defined as an acceptable token then there's >> nothing to

Re: Other notes

2005-01-06 Thread Andrew Dalke
Me (BTW, it needs to be 1 .. 12 not 1..12 because 1. will be interpreted as the floating point value "1.0".)< Steve Holden: > Indeed, but if ".." is defined as an acceptable token then there's > nothing to stop a strict LL(1) parser from disambiguating the cases in > question. "Token"

Re: Other notes

2005-01-06 Thread Steve Holden
Timo Virkkala wrote: [EMAIL PROTECTED] wrote: Andrew Dalke: (BTW, it needs to be 1 .. 12 not 1..12 because 1. will be interpreted as the floating point value "1.0".)< Uhm, I have to fix my ignorance about parsers. Cannot a second "." after the first tell that the first "." isn't in the middle of a

Re: Other notes

2005-01-06 Thread Timo Virkkala
[EMAIL PROTECTED] wrote: Andrew Dalke: (BTW, it needs to be 1 .. 12 not 1..12 because 1. will be interpreted as the floating point value "1.0".)< Uhm, I have to fix my ignorance about parsers. Cannot a second "." after the first tell that the first "." isn't in the middle of a floating point number

Re: Other notes

2005-01-05 Thread bearophileHUGS
Thank you to all the gentle people that has given me some comments, and sorry for bothering you... Doug Holton: >This will also likely never appear in Python. I know, that's why I've defined it "wild". >Also, you might request the NetLogo and StarLogo developers to support Jython (in addition

Re: Other notes

2004-12-30 Thread Jp Calderone
On Thu, 30 Dec 2004 15:16:42 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote: >Jp Calderone <[EMAIL PROTECTED]> writes: > > > On Wed, 29 Dec 2004 12:38:02 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote: > >>Jp Calderone <[EMAIL PROTECTED]> writes: > >> > This aside, not even Python 3.0 will be flexible

Re: Other notes

2004-12-30 Thread Mike Meyer
"Terry Reedy" <[EMAIL PROTECTED]> writes: > "Mike Meyer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Steve Holden <[EMAIL PROTECTED]> writes: >>> Well, perhaps you can explain how a change that's made at run time >>> (calling the decorator) can affect the parser's compile tim

Re: Other notes

2004-12-30 Thread Mike Meyer
Steve Holden <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: > >> Steve Holden <[EMAIL PROTECTED]> writes: >> > [...] >>> >>>Well, perhaps you can explain how a change that's made at run time >>>(calling the decorator) can affect the parser's compile time behavior, >>>then. At the moment, IIRC, th

Re: Other notes

2004-12-30 Thread Mike Meyer
Jp Calderone <[EMAIL PROTECTED]> writes: > On Wed, 29 Dec 2004 12:38:02 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote: >>Jp Calderone <[EMAIL PROTECTED]> writes: >> > This aside, not even Python 3.0 will be flexible enough to let you define >> > an infix decorator. The language developers are str

Re: Other notes

2004-12-30 Thread Steve Holden
Bengt Richter wrote: On Wed, 29 Dec 2004 13:11:43 -0500, Steve Holden <[EMAIL PROTECTED]> wrote: [...] Well, perhaps you can explain how a change that's made at run time (calling the decorator) can affect the parser's compile time behavior, then. At the moment, IIRC, the only way Python code can

Re: Other notes

2004-12-29 Thread Bengt Richter
On Thu, 30 Dec 2004 04:46:25 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: [...] >Ok, well, that's happened to me before ;-) >We'll have to find a way to make it illegal, but it's not likely to be quite >as clean. > >x ..OP y >x ./OP y >x .x .. y >X ._OP_. y Bzzzt! ;-/ >x

Re: Other notes

2004-12-29 Thread Bengt Richter
On Thu, 30 Dec 2004 03:55:12 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: [.. buncha stuff alzheimersly based on x.attr not being parsed as x.attr ;-/ ] > from rational import rat as RAT > > if x .RAT. y > 1 .RAT. 3: do_it() > >or > your turn ;-) > Andrew got there first ;-) Still, see my

Re: Other notes

2004-12-29 Thread Bengt Richter
On Thu, 30 Dec 2004 03:37:38 GMT, Andrew Dalke <[EMAIL PROTECTED]> wrote: >Bengt Richter: >> OTOH, there is precedent in e.g. fortran (IIRC) for named operators of the >> form .XX. -- e.g., .GE. for >= so maybe there could be room for both. > >> Hm, you could make >> >> x .infix. y > > >>

Re: Other notes

2004-12-29 Thread Bengt Richter
On Wed, 29 Dec 2004 13:11:43 -0500, Steve Holden <[EMAIL PROTECTED]> wrote: >Mike Meyer wrote: > >> [EMAIL PROTECTED] writes: >> >> >>>@infix >>>def interval(x, y): return range(x, y+1) # 2 parameters needed >>> >>>This may allow: >>>assert 5 interval 9 == interval(5,9) >> >> >> I don't like t

Re: Other notes

2004-12-29 Thread Andrew Dalke
Bengt Richter: > OTOH, there is precedent in e.g. fortran (IIRC) for named operators of the > form .XX. -- e.g., .GE. for >= so maybe there could be room for both. > Hm, you could make > > x .infix. y > x .op1. y .op2. z => op2(op1(x, y), z) The problem being that that's already legal s

Re: Other notes

2004-12-29 Thread Bengt Richter
On Wed, 29 Dec 2004 11:42:00 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] writes: > >> @infix >> def interval(x, y): return range(x, y+1) # 2 parameters needed >> >> This may allow: >> assert 5 interval 9 == interval(5,9) > >I don't like the idea of turning words into operators.

Re: Other notes

2004-12-29 Thread Terry Reedy
"Mike Meyer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Steve Holden <[EMAIL PROTECTED]> writes: >> Well, perhaps you can explain how a change that's made at run time >> (calling the decorator) can affect the parser's compile time behavior, >> then. At the moment, IIRC, the onl

Re: Other notes

2004-12-29 Thread Terry Reedy
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'll second that. Please, "Bearophile", do us the courtesy of checking > > (1) Google groups archive of the mailing list: > http://groups-beta.google.com/group/comp.lang.python > > and > > (2) The Python Enhancement P

Re: Other notes

2004-12-29 Thread Steve Holden
Mike Meyer wrote: Steve Holden <[EMAIL PROTECTED]> writes: [...] Well, perhaps you can explain how a change that's made at run time (calling the decorator) can affect the parser's compile time behavior, then. At the moment, IIRC, the only way Python code can affect the parser's behavior is in the _

Re: Other notes

2004-12-29 Thread Jp Calderone
On Wed, 29 Dec 2004 12:38:02 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote: >Jp Calderone <[EMAIL PROTECTED]> writes: > > > On Wed, 29 Dec 2004 11:42:00 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote: > >>[EMAIL PROTECTED] writes: > >> > >> > @infix > >> > def interval(x, y): return range(x, y+1) # 2

Re: Other notes

2004-12-29 Thread Mike Meyer
Steve Holden <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: > >> [EMAIL PROTECTED] writes: >> >>>@infix >>>def interval(x, y): return range(x, y+1) # 2 parameters needed >>> >>>This may allow: >>>assert 5 interval 9 == interval(5,9) >> I don't like the idea of turning words into operators. I'd mu

Re: Other notes

2004-12-29 Thread Mike Meyer
Jp Calderone <[EMAIL PROTECTED]> writes: > On Wed, 29 Dec 2004 11:42:00 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote: >>[EMAIL PROTECTED] writes: >> >> > @infix >> > def interval(x, y): return range(x, y+1) # 2 parameters needed >> > >> > This may allow: >> > assert 5 interval 9 == interval(5,9) >

Re: Other notes

2004-12-29 Thread Jp Calderone
On Wed, 29 Dec 2004 11:42:00 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] writes: > > > @infix > > def interval(x, y): return range(x, y+1) # 2 parameters needed > > > > This may allow: > > assert 5 interval 9 == interval(5,9) > > I don't like the idea of turning words into ope

Re: Other notes

2004-12-29 Thread Steve Holden
Mike Meyer wrote: [EMAIL PROTECTED] writes: @infix def interval(x, y): return range(x, y+1) # 2 parameters needed This may allow: assert 5 interval 9 == interval(5,9) I don't like the idea of turning words into operators. I'd much rather see something like: @infix('..') def interval(x, y): re

Re: Other notes

2004-12-29 Thread Mike Meyer
[EMAIL PROTECTED] writes: > @infix > def interval(x, y): return range(x, y+1) # 2 parameters needed > > This may allow: > assert 5 interval 9 == interval(5,9) I don't like the idea of turning words into operators. I'd much rather see something like: @infix('..') def interval(x, y): return ra

RE: Other notes

2004-12-29 Thread Batista, Facundo
Title: RE: Other notes [EMAIL PROTECTED] #- Here are some questions and suggestions of mine that I've #- collected in #- the last weeks on the language (please note that some (most?) of them #- are probably wrong/useless/silly, but I've seen that such #- notes help me #- unders

Re: Other notes

2004-12-28 Thread Andrew Dalke
Paul Rubin wrote: > ".." just becomes an operator like + or whatever, which you can define > in your class definition: > > class MyClass: >def __dotdot__(self, other): > return xrange(self.whatsit(), other.whatsit()) > > The .. operation is required to return an iterator. A

Re: Other notes

2004-12-28 Thread Steven Bethard
Andrew Dalke wrote: I must say it's getting pretty annoying to say things like "when would this be useful?" and "have you read the documentation?" for your statements. I'll second that. Please, "Bearophile", do us the courtesy of checking (1) Google groups archive of the mailing list: http://group

Re: Other notes

2004-12-28 Thread Steven Bethard
[EMAIL PROTECTED] wrote: 4) The printf-style formatting is powerful, but I still think it's quite complex for usual purposes, and I usually have to look its syntax in the docs. I think the Pascal syntax is nice and simpler to remember (especially for someone with a little Pascal/Delphi experience ^

Re: Other notes

2004-12-28 Thread Paul Rubin
Andrew Dalke <[EMAIL PROTECTED]> writes: > What does > a = MyClass() > b = AnotherClass() > for x in a .. b: > print x > > do? That is, what's the generic protocol? ".." just becomes an operator like + or whatever, which you can define in your class definition: class MyClass:

Re: Other notes

2004-12-28 Thread Andrew Dalke
bearophileHUGS: [on Python's O(n) list insertion/deletion) at any place other than tail > (My hypothesis: to keep list implementation a bit simpler, to avoid > wasting memory for the head buffer, and to keep them a little faster, > avoiding the use of the skip index S). Add its relative infrequent

Re: Other notes

2004-12-28 Thread Doug Holton
[EMAIL PROTECTED] wrote: for i in 1..12: pass for c in "a".."z": pass > @infix > def interval(x, y): return range(x, y+1) # 2 parameters needed > assert 5 interval 9 == interval(5,9) > 10) There can be something in the middle between the def statement and > the lambda. These will likely n

Other notes

2004-12-28 Thread bearophileHUGS
Here are some questions and suggestions of mine that I've collected in the last weeks on the language (please note that some (most?) of them are probably wrong/useless/silly, but I've seen that such notes help me understand a lot of things and to find my weak spots.) 1) I've seen that list pop/app