[Python-Dev] Re: [SPAM: 3.611] IPython, @, and option E from the wiki

Fernando Perez fperez528 at yahoo.com
Wed Aug 11 14:16:59 CEST 2004


Greg Ewing wrote:

> 3. In this kind of setup, using | instead of @ would be ok as well, I guess:
> Fernando Perez <fperez528 at yahoo.com>:
> 
>> def bar(low,high):
>>    |accepts(int,int)
>>    |returns(float)
> 
> How about
> 
>   def bar(low,high):
>     ...accepts(int,int)
>     ...returns(float)

The ellipsis is alredy valid python syntax elsewhere:

In [7]: a=arange(3**3)

In [8]: a.shape=(3,3,3)

In [9]: a[:,...,:]
Out[9]:
array([[[ 0,  1,  2],
        [ 3,  4,  5],
        [ 6,  7,  8]],
       [[ 9, 10, 11],
        [12, 13, 14],
        [15, 16, 17]],
       [[18, 19, 20],
        [21, 22, 23],
        [24, 25, 26]]])

I don't think it would be a good idea to make it do this kind of double-duty.

best,

f



More information about the Python-Dev mailing list