def weld_tail(array, length, n):
    """Return the last n elements.

    Parameters
    ----------
    array : numpy.ndarray or WeldObject
        Array to select from.
    length : int or WeldObject
        Length of the array. Int if already known can simplify the computation.
    n : int
        How many values.

    Returns
    -------
    WeldObject
        Representation of the computation.

    """
    obj_id, weld_obj = create_weld_object(array)
    if isinstance(length, WeldObject):
        length = get_weld_obj_id(weld_obj, length)
        slice_start = '{} - {}L'.format(length, n)
        slice_stop = '{}'.format(length)
    else:
        slice_start = '{}L - {}L'.format(length, n)
        slice_stop = '{}L'.format(length)

    weld_template = """slice(
    {array},
    {slice_start},
    {slice_stop}
)"""

    weld_obj.weld_code = weld_template.format(array=obj_id,
                                              slice_start=slice_start,
                                              slice_stop=slice_stop)

    return weld_obj
def weld_tail ( array , length , n ) : obj_id , weld_obj = create_weld_object ( array ) if isinstance ( length , WeldObject ) : length = get_weld_obj_id ( weld_obj , length ) slice_start = '{} - {}L' . format ( length , n ) slice_stop = '{}' . format ( length ) else : slice_start = '{}L - {}L' . format ( length , n ) slice_stop = '{}L' . format ( length ) weld_template = """slice(
    {array},
    {slice_start},
    {slice_stop}
)""" weld_obj . weld_code = weld_template . format ( array = obj_id , slice_start = slice_start , slice_stop = slice_stop ) return weld_obj
Return the last n elements.

    Parameters
    ----------
    array : numpy.ndarray or WeldObject
        Array to select from.
    length : int or WeldObject
        Length of the array. Int if already known can simplify the computation.
    n : int
        How many values.

    Returns
    -------
    WeldObject
        Representation of the computation.