[Numpy-discussion] Obscure code in concatenate code path?

Travis Oliphant travis at continuum.io
Thu Sep 13 13:35:34 EDT 2012


>> 
>> 
>> This is expected behavior.   It's how the concatenate Python function manages to handle axis=None to flatten the arrays before concatenation.    This has been in NumPy since 1.0 and should not be changed without deprecation warnings which I am -0 on.
>> 
>> Now, it is true that the C-API could have been written differently (I think this is what Mark was trying to encourage) so that there are two C-API functions and they are dispatched separately from the array_concatenate method depending on whether or not a None is passed in.   But, the behavior is documented and has been for a long time.
>> 
>> Reference PyArray_AxisConverter (which turns a "None" Python argument into an axis=MAX_DIMS).   This is consistent behavior throughout the C-API.
> 
> How about something like:
> 
> #define NPY_NONE_AXIS NPY_MAXDIMS
> 
> to make it clearer what is intended?

+1

-Travis




More information about the NumPy-Discussion mailing list