Quote:
Originally Posted by Inverness
Skipping over Stefan's posts usually isn't a smart thing to do. If you don't understand it then just think really hard about how arrays work.
|
Just noticed my previous post is a really misleading way of deleting half the list.
Anyway, similar method, different language but guaranteed to work:
PHP Code:
>>> foo = [1, "bar", False, ["baz", "crux"], 9]
>>> cruux = len(foo)
>>> for i in range(cruux):
... print "Foo: " + str(foo[0])
... foo.remove(foo[0])
...
Foo: 1
Foo: bar
Foo: False
Foo: ['baz', 'crux']
Foo: 9
>>> foo
[]
>>>
All assuming the precise functioning of this "special intelligent object" did not elude me.