>
>
>
> (1) Since this function always returns True (if it returns at all), what
> is the point? There's no point checking the return result, since it's
> always true, so why bother returning anything?
>
>

If  I don't return anything from a function it returns None.   But would it
be better if for the  function  i.e modify_various_line(f) to  atleast catch
or handle exceptions and log it for debugging purpose

Example:

def modify_various_line(f):
    """ Try modifiying various line """
    try:
        f.write('0123456789abcdef')
        f.seek(5)     # Go to the 6th byte in the file
        print f.read(1)
        f.seek(-3, 2) # Go to the 3rd byte before the end
        print f.read(1)
        f.write('END')
    except IOError as e:
       logging.error("Error: got %s" , % (str(e)))
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to