[SciPy-user] assign to diagonal values?

Robert Kern robert.kern at gmail.com
Sat May 23 17:33:37 EDT 2009


On Sat, May 23, 2009 at 16:26, Alan G Isaac <aisaac at american.edu> wrote:
>> On Sat, May 23, 2009 at 16:02, Alan G Isaac wrote:
>>> On 1/31/2008 1:37 AM Anne Archibald apparently wrote:
>>>> m[range(n),range(n)]=new_diagonal
>>> Will that work with range objects (in Python 3)?
>
> On 5/23/2009 5:05 PM Robert Kern apparently wrote:
>> No. The automatic conversion to arrays does not consume iterators (nor
>> will it when we port to Python 3).
>
> Sure, but range objects are not iterators.
> They are "almost" sequences.

The answer is still no. Perhaps someone will write special support for
that type when we do the Python 3 port, but there's nothing in numpy
that would make it work automatically. For example, xrange() does not
work as an index with the current numpy.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco



More information about the SciPy-User mailing list