def array_shift(a, n, fill="<STR_LIT>"):
new_a = _n.array(a)<EOL>if n==<NUM_LIT:0>: return new_a<EOL>fill_array = _n.array([])<EOL>fill_array.resize(_n.abs(n))<EOL>if   fill is "<STR_LIT>": fill_array = <NUM_LIT:0.0>*fill_array + _n.average(a)<EOL>elif fill is "<STR_LIT>" and n >= <NUM_LIT:0>:<EOL><INDENT>for i in range(<NUM_LIT:0>,n): fill_array[i] = a[i-n]<EOL><DEDENT>elif fill is "<STR_LIT>" and n < <NUM_LIT:0>:<EOL><INDENT>for i in range(<NUM_LIT:0>,-n): fill_array[i] = a[i]<EOL><DEDENT>else:   fill_array = <NUM_LIT:0.0>*fill_array + fill<EOL>if n > <NUM_LIT:0>:<EOL><INDENT>for i in range(n, len(a)): new_a[i] = a[i-n]<EOL>for i in range(<NUM_LIT:0>, n):      new_a[i] = fill_array[i]<EOL><DEDENT>else:<EOL><INDENT>for i in range(<NUM_LIT:0>, len(a)+n): new_a[i] = a[i-n]<EOL>for i in range(<NUM_LIT:0>, -n):       new_a[-i-<NUM_LIT:1>] = fill_array[-i-<NUM_LIT:1>]<EOL><DEDENT>return new_a<EOL>
This will return an array with all the elements shifted forward in index by n.

a is the array
n is the amount by which to shift (can be positive or negative)

fill="average"      fill the new empty elements with the average of the array
fill="wrap"         fill the new empty elements with the lopped-off elements
fill=37.2           fill the new empty elements with the value 37.2