ivec = n*[None]
so that if I use a list element before intializing it, for example
ivec[0] += 1
I get an error message
File "xxnone.py", line 2, in ? ivec[0] += 1 TypeError: unsupported operand type(s) for +=: 'NoneType' and 'int'
This is in the same spirit as Python's (welcome) termination of a program when one tries to use an uninitalized scalar variable.
I feel foolish that I forgot about *. I've just started with Python then took 2 weeks off. I'll explore pre-allocation when I'm back up to speed.
Yep, I use None a lot.
Thanks
Jim -- http://mail.python.org/mailman/listinfo/python-list