hi,

there are 2 versions of a simple code.
which is preferred?


===
if len(line) >= (n+1):
        text = line[n]
else:
        text = 'nothing'
===


===
try:
        text = line[n]
except IndexError:
        text = 'nothing'
===


which is the one you would use?

thanks,
gabor
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to