[Bf-python] Matrix length incorrect

wim van hoydonck wim.van.hoydonck at gmail.com
Fri Jun 20 21:49:24 CEST 2008


On 6/20/08, Campbell Barton <ideasman42 at gmail.com> wrote:
>
>
>  How about change this to return the number of rows and add a .size()
>  method that works like len() does now?
>  this may break some scripts, so they will have to be updated - if we
>  ever have a 2.48 release.

Would it not be better to just use 1 function that returns the total
size of the array by default, and when supplied with an optional
argument (dim), returns the size of that dimension of the array (as
Fortran's "size")?

This wouldn't break existing scripts.

e.g.
$ cat test.f90
program test

  implicit none

  integer :: mat(10,5)

  print *, size(mat)          ! 50
  print *, size(mat,dim=1)    ! 10
  print *, size(mat,dim=2)    ! 5

end program test


Wim



More information about the Bf-python mailing list