[C++-sig] GNU gettext and "_"

Pearu Peterson pearu at cens.ioc.ee
Thu Jun 20 15:54:42 CEST 2002


On Thu, 20 Jun 2002, David Abrahams wrote:

> ----- Original Message -----
> From: "Pearu Peterson" <pearu at cens.ioc.ee>
> 
> > "Obvious" to me would be to use the same convention as used in Python
> > slice object, that is,
> >
> >   x[:y]   would be x.slice(None,y)
> >   x[:y:]  would be x.slice(None,y,None)
> >   etc.
> 
> Unfortunately not equivalent.

Read the source code.

> >>> range(10)[slice(None:3)]
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: sequence index must be integer

This example is nonsense. First 
  slice(None:3)
gives syntax error, and second also 
  range(10)[slice(1:3)]
gives 
  TypeError: sequence index must be integer
because index of a list *must* be integer, not a slice or anything else.

Pearu






More information about the Cplusplus-sig mailing list