[petsc-dev] Correct syntax for DMDA ownership ranges in petsc4py

Lawrence Mitchell lawrence.mitchell at imperial.ac.uk
Fri Apr 8 03:01:53 CDT 2016


> On 8 Apr 2016, at 08:29, Chris Eldred <chris.eldred at gmail.com> wrote:
> 
> 
> Yes I have tried all possible variants:
> [(8,8,4),]
> ([8,8,4],)
> [[8,8,4],]
> ((8,8,4),)
> and they all fail with the same
> TypeError: Expected tuple, got list
> 
> However, I think I see what is happening now. In line 156
>    cdef object ranges = list(ownership_ranges)
> it looks like ranges is being defined as a list, rather than a tuple.
> So maybe there should be a cast from list to tuple in the return
> statement?

That looks right, since the return type of asOwnerShipRanges is declared as tuple, but as you note, the return variable has type list.

Lawrence
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20160408/13190ee5/attachment.sig>


More information about the petsc-dev mailing list