From: Nicolas C. <war...@fr...> - 2003-10-05 11:40:36
|
> one function that people may want to have in the standard library is > "read_file", which opens a file with a given name and returns its complete > contents as a string: [...] > This functions is optimal for files, because it uses the length of the > file to determine the required buffer size. Nice > Note the following behaviour: if reading causes an exception, the program > will attempt to close the opened file. If this also causes an exception, > the FIRST exception will be reraised. I think this is the most reasonable > way to handle this. I agree, but if I follow the specification of really_input : "Read len characters from the given channel, storing them in string buf, starting at character number pos. Raise End_of_file if the end of file is reached before len characters have been read. Raise Invalid_argument "really_input" if pos and len do not designate a valid substring of buf." Then it shouldn't raise any exception. Nicolas Cannasse |