FW: [Numpy-discussion] Bug: extremely misleading array behavior

Konrad Hinsen hinsen at cnrs-orleans.fr
Wed Jun 12 01:55:03 EDT 2002


"eric jones" <eric at enthought.com> writes:

> others) would be very slow with this approach.  Your copy-on-demand
> suggestion might work though.  Its implementation would be more complex,
> but I don't think it would require cooperation from the Python core.?

It wouldn't, and I am not sure the implementation would be much more
complex, but then I haven't tried. Having both copy on demand and
views is difficult, both conceptually and implementationwise, but
with copy-on-demand, views become less important.

> Copy-on-demand doesn't really fit with python's 'assignments are
> references" approach to things though does it?  Using foo = bar in
> Python and then changing an element of foo will also change bar.  So, I

That would be true as well with copy-on-demand arrays, as foo and bar
would be the same object. Semantically, copy-on-demand would be
equivalent to copying when slicing, which is exactly Python's
behaviour for lists.

> So, how about add.reduce() keep axis=0 to match the behavior of Python,
> but sum() and friends defaulted to axis=-1 to match the rest of the

That sounds like the most arbitrary inconsistency - add.reduce and sum
are synonyms for me.

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------




More information about the NumPy-Discussion mailing list