From: Charles R H. <cha...@gm...> - 2006-08-29 19:25:17
|
Hi Fernando, On 8/29/06, Fernando Perez <fpe...@gm...> wrote: > > On 8/29/06, Charles R Harris <cha...@gm...> wrote: > > > Speaking of features, I wonder if more of the methods should return > > references. For instance, it might be nice to write something like: > > > > a.sort().searchsorted([...]) > > > > instead of making two statements out of it. > > +1 for more 'return self' at the end of methods which currently don't > return anything (well, we get the default None), as long as it's > sensible. I really like this 'message chaining' style of programming, > and it annoys me that much of the python stdlib gratuitously prevents > it by NOT returning self in places where it would be a perfectly > sensible thing to do. My pet peeve example: a.reverse() I would also like to see simple methods for "+=" operator and such. Then one could write x = a.copy().add(10) One could make a whole reverse polish translator out of such operations and a few parenthesis. I have in mind some sort of code optimizer. Chuck |