[Numpy-discussion] Re: [Matrix-SIG] An Experiment in code-cleanup.

Konrad Hinsen hinsen at cnrs-orleans.fr
Wed Feb 9 12:31:00 EST 2000


> > In addition to backwards compatibility, there is another argument for
> > keeping indexing behaviour as it is: compatibility with other Python
> > sequence types.
> 
> I claim the current Numeric is INconsistent with other Python sequence
> types:
> 
> >>> x = [1, 2, 3, 4, 5]
> >>> y = x[2:5]
> >>> x
> [1, 2, 3, 4, 5]
> >>> y
> [3, 4, 5]
> >>> y[1] = 7
> >>> y
> [3, 7, 5]
> >>> x
> [1, 2, 3, 4, 5]
> 
> So, y is a copy of x[2:5], not a reference.

Good point. So we can't be consistent with all properties of other
Python sequence types.

Which reminds me of some very different compatibility problem in NumPy
that can (and should) be removed: the rules for integer division and
remainders for negative arguments are not the same. NumPy inherits the
C rules, Python has its own.

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
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