On Mon, 12 Sep 2005 12:52:52 +0200, gabor <[EMAIL PROTECTED]> wrote: > hi, > > there are 2 versions of a simple code. > which is preferred?
I don't know. Who cares? > === > try: > text = line[n] > except IndexError: > text = 'nothing' > === > > > which is the one you would use? The 'try' version. But I'd also ask myself how I could end up in a state where this part of the code is asked to find a string that doesn't exist, and if I really want it to keep running, with a made-up value. /Jorgen -- // Jorgen Grahn <jgrahn@ Ph'nglui mglw'nafh Cthulhu \X/ algonet.se> R'lyeh wgah'nagl fhtagn! -- http://mail.python.org/mailman/listinfo/python-list