[Numpy-discussion] Response to PEP suggestions

Travis Oliphant oliphant at ee.byu.edu
Fri Feb 18 10:00:24 CST 2005


konrad.hinsen at laposte.net wrote:

> My view of pythonicity is that retrieving a value should be written as 
> attribute access. Methods are more appropriate if there are arguments 
> (no choice then anyway) or side effects. So I'd have .type as an 
> attribute.

That's my view as well.

>
> BTW, as the goal is inclusion into the Python core, why not
>
> 1) Use Python type objects for array creation and as the values of the 
> .type
>     attribute.

Do you mean have register each of the 21 different types of arrays as a 
new type object?   Hmm.   That is an interesting idea.   I'm a little 
worried about implications for having the arrays behave together, though 
it would make it more straightforward to define specific mixed 
operations.    This does deserve a little more thought.

> 2) Implement scalar types for those array element types that currently
>     have no Python scalar equivalent (e.g. UInt16).

Do you think this would fly with the Python folks.  Counting the 
suggestion above, we would be encouraging the creation of 39 new types 
to the Python core.  My current count shows the current number of types 
as 35 so we would basically double that.   This doesn't have to matter, 
but I'd have to hear how Guido feels about something like that.

> 3) Implement the same set of attributes of methods for scalar types and
>    arrays.

That would be ideal.   But, I'm not sure what kind of chance we have 
with that.

-Travis





More information about the Numpy-discussion mailing list