[issue5700] io.FileIO calls flush() after file closed

Brian Quinlan report at bugs.python.org
Sun Apr 12 20:19:43 CEST 2009


Brian Quinlan <brian at sweetapp.com> added the comment:

Antoine Pitrou wrote:
> Antoine Pitrou <pitrou at free.fr> added the comment:
> 
>> No, doing this is trivial. But shouldn't it be up to the implementor of 
>> MyClass to decide whether MyMixin or io.FileIO methods are evaluated first?
> 
> Is there a concrete use case, though?

I don't have a good one in mind - though

> By the way, what if _pyio.FileIO inherited from io.FileIO instead of
> delegating all methods?

I don't think that would work - but reasoning about MRO hurts my brain ;-)

You'd have to declare the class like this:

class FileIO(io.FileIO, IOBase):
   pass

to get the io.File methods to resolve first. But that means that the 
method invocation chain would be broken by io.IOBase, which doesn't make 
super calls.

Cheers,
Brian

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5700>
_______________________________________


More information about the Python-bugs-list mailing list