[IPython-user] Macros & slice notation

Fernando Perez Fernando.Perez at colorado.edu
Fri Dec 30 12:13:17 CST 2005


Alan G Isaac wrote:
> On Fri, 30 Dec 2005, Fernando Perez apparently wrote: 
> 
>>we could change the range syntax in %macro and %save to use 
>>N-M
> 
> 
> Maybe N--M?

Why the extra dash?  This is not an arithmetic operation: magics already 
handle 'command-line' dashed flags, so I'm not sure I see the need for '--' 
instead of just '-'.

>>instead of N:M 
> 
> 
> Maybe as an alternative to regular slices,
> which would still work as expected (by Python users).

Do you mean having both?  I'm -0.5 on that: too many ways of doing things is a 
recipe for unnecessary confusion (think perl).  I'd rather have one, good and 
intuitive way to do it: the human brain (at least mine :) is good at 
remembering specific use cases, as long as they remain reasonably orthogonal. 
  What gets confusing is having to deal with things that are 'kind of the 
same, but not really': I think I'd stop each time to think, 'is this a slice 
or not?'.  If I simply know that 'line ranges are given as N-M, where N and M 
are the endpoints I want, as shown by %hist', then there's no confusion.

Just my 1e-2.

Cheers,

f




More information about the IPython-user mailing list