[Numpy-discussion] array, asarray as contiguous and friends
Travis Oliphant
oliphant at ee.byu.edu
Thu Mar 23 13:59:03 EST 2006
Sasha wrote:
>On 3/23/06, Travis Oliphant <oliphant at ee.byu.edu> wrote:
>
>
>>Thus, in my mind, the array call should get another flag keyword that
>>forces a contiguous result.
>>
>>
>
>Please don't! The fortran flag is bad enough, but has too much history
>behind it. Let's not breed boolean parameters. Sooner or later
>someone will use keword arguments positionally and you will end up
>guessing what
>
>
There are several boolean flags in the interface already. Adding
another one won't change the current situation that you describe.
There are several ways to handle this. For one, we could force the use
of keyword arguments, so that the position problem does not arise.
Sasha has mentioned in the past a strides array argument, but I think
the default fortran and contiguous strides cases need better support
then just one of many possible stridings so I wouldn't go that direction
here.
I'm debating whether or not the fortran flag should be used to specify
both contiguous and fortran cases. Right now, the fortran argument is a
three-case flag with dont-care, True, and False arguments. It seems
natural to have True mean force-fortran and False mean force-contiguous
with dont-care (the default) mean take an array already given (or create
a C-contiguous array if we are generating a new array from another object).
At any rate, if the fortran flag is there, we need to specify the
contiguous case as well. So, either propose a better interface (we
could change it still --- the fortran flag doesn't have that much
history) to handle the situation or accept what I do ;-)
-Travis
More information about the NumPy-Discussion
mailing list