[Numpy-discussion] Response to PEP suggestions

konrad.hinsen at laposte.net konrad.hinsen at laposte.net
Fri Feb 18 23:45:24 CST 2005

On 18.02.2005, at 23:02, Stephen Walton wrote:

> Duncan Child wrote:
>> In another post [Konrad Hinsen] said:
>> "... as the goal is inclusion into the Python core .... I propose  
>> that the PEP should include unification of scalars and arrays such  
>> that for all practical purposes scalars *are* rank-0 arrays. "
>> So I think we are in broad agreement.
> It seems to me that actually getting the above behavior is going to  
> require Guido van Rossum et al. to change how scalars behave in the  
> Python core.  As I said, right now min(scalar) in stock Python raises  
> a TypeError on the grounds that scalars can't be iterated over.

That's fine - scalars (like rank-0 arrays) cannot be iterated over.

However, there would indeed have to be changes to scalars. For example,  
1.shape would have to return ().

Konrad Hinsen
Laboratoire Leon Brillouin, CEA Saclay,
91191 Gif-sur-Yvette Cedex, France
Tel.: +33-1 69 08 79 25
Fax: +33-1 69 08 82 61
E-Mail: khinsen at cea.fr

More information about the Numpy-discussion mailing list