And if you don't need the removed value, there is also:
>>> xxx = [1,2,3,4,5]
>>> xxx
[1, 2, 3, 4, 5]
>>> del xxx[0]
>>> xxx
[2, 3, 4, 5]
>>>
Re: Multi-dimensional arrays:
I've used tuple-indexed dictionaries for sparse arrays.
For real homogeneous ( i.e. all integer or floating point )
arrays, you can wrap array module in a class that maps n-dim.
indexes into 1-dimensional indexes.
Note that for tuple-indexed dictionaries and tuple-indexed classes,
the syntax MUST be:
array[(i,j)]
and not:
array[i,j]
which is a syntax error.
When I have used this, I find remembering to wrap the naked tuple
into a single tuple arg a source of mistakes. Is there a reason
why we couldn't relax the syntax here some way ?
I haven't looke at the grammer here, but I assume it's a precedence
problem. Unwrapped tuples are valid in many places, and indexing
does have a different syntax than function call, so I don't think
there is an ambiguity problem with the rule that whatever is inside
"[" ... "]" is a single argument. i.e.
array[i,j] == array[(i,j)]
both notations would be equivalent and might both be dispatched to:
__getitem__( self, index )
i,j = index
...
---| Steven D. Majewski (804-982-0831) <sdm7g@Virginia.EDU> |---
---| Computer Systems Engineer University of Virginia |---
---| Department of Molecular Physiology and Biological Physics |---
---| Box 449 Health Science Center Charlottesville,VA 22908 |---