lshift

decida.lshift(inputlist)

shift list and return first element.

arguments:

inputlist (list)

list to be shifted

results:

  • set inputlist to 2nd to last elements of original inputlist
  • return first element in inputlist

example:

>>> import decida
>>> lst = [1, 2, 4, 5, 9]
>>> a = decida.lshift(lst)
>>> print "a =", a, ", lst =", lst
'a = 1 , lst = [2, 4, 5, 9]'

notes:

lshift command used extensively in Tcl scripts, but pythonic lhs = inputlist.pop(0) is just as simple

Previous topic

interpolate

Next topic

multiline

This Page