python file API

Mark Lawrence breamoreboy at yahoo.co.uk
Tue Sep 25 03:27:21 EDT 2012


On 25/09/2012 03:32, Mark Adam wrote:
> On Mon, Sep 24, 2012 at 5:55 PM, Oscar Benjamin
> <oscar.j.benjamin at gmail.com> wrote:
>> There are many situations where a little bit of attribute access magic is a
>> good thing. However, operations that involve the underlying OS and that are
>> prone to raising exceptions even in bug free code should not be performed
>> implicitly like this. I find the following a little cryptic:
>> try:
>>      f.pos = 256
>> except IOError:
>>      print('Unseekable file')
>
> Well it might be that the coupling between the python interpreter and
> the operating system should be more direct and there should be a
> special exception class that bypasses the normal overhead in the
> CPython implementation so that error can be caught in the code without
> breaking syntax.  But I don't think I'm ready to argue that point....
>
> markj
>

Something along these lines 
http://docs.python.org/dev/whatsnew/3.3.html#pep-3151-reworking-the-os-and-io-exception-hierarchy 
?

-- 
Cheers.

Mark Lawrence.




More information about the Python-list mailing list