[SciPy-dev] Difference between A = sparse.lil_matrix((3, 3), dtype=complex) and A = sparse.lil_matrix((3, 3), complex)

Nathan Bell wnbell at gmail.com
Sat Feb 16 15:43:04 EST 2008


On Feb 16, 2008 2:21 PM, Nils Wagner <nwagner at iam.uni-stuttgart.de> wrote:
> Hi all,
>
> Can someone explain the difference between
>
> A = sparse.lil_matrix((3, 3),dtype=complex) and
>
> A = sparse.lil_matrix((3, 3),complex)
>
> The first definition produces a complex matrix while
> the second one results in a  r e a l  matrix.
>
> This is counterintuitive.

The latter case, 'complex' is being assigned to the shape= argument
(which was ignored).  This usage now raises an exception.

You should always use keyword= for keyword arguments instead of
relying on their order.

-- 
Nathan Bell wnbell at gmail.com
http://graphics.cs.uiuc.edu/~wnbell/



More information about the SciPy-Dev mailing list