[Numpy-discussion] concatenate, doc-string

David M. Cooke cookedm at physics.mcmaster.ca
Wed Apr 26 12:48:04 CDT 2006


Arnd Baecker <arnd.baecker at web.de> writes:

> Hi,
>
> the doc-string of concatentate is pretty short:
>
> numpy.concatenate?
> Docstring:
>     concatenate((a1,a2,...),axis=None).
>
> Would the following be better:
> """
> concatenate((a1, a2,...), axis=None) joins the tuple  `(a1, a2, ...)` of
> sequences (or arrays) into a single numpy array.
>
> Example::
>
>   print concatenate( ([0,1,2], [5,6,7]))
> """
>
> ((The ``(or arrays)`` could be omitted if sequences include array by
> default, though it might not be obvious to beginners ...))

Here's what I just checked in:

    concatenate((a1, a2, ...), axis=None) joins arrays together

    The tuple of sequences (a1, a2, ...) are joined along the given axis
    (default is the first one) into a single numpy array.

    Example:

    >>> concatenate( ([0,1,2], [5,6,7]) )
    array([0, 1, 2, 5, 6, 7])

> I was also tempted to suggest a dtype argument,
>   concatenate( ([0,1,2], [5,6,7]), dtype=numpy.Float)
> but I am not sure if that would be a good idea ...

Well, that would require more code, so I didn't do it :-)

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca




More information about the Numpy-discussion mailing list