Py3K: file inheritance

Ian Kelly ian.g.kelly at gmail.com
Thu Oct 20 13:42:13 EDT 2011


On Thu, Oct 20, 2011 at 11:28 AM, Yosifov Pavel <bulg at ngs.ru> wrote:
> In the Python 2.x was simple to create own file object:
>
> class MyFile(file):
>  pass
>
> for example to reimplement write() or something else. How to do it in
> Python 3.x?

See the docs for the io module.  Depending on what you want to do, you
probably need to subclass either io.FileIO or io.TextIOWrapper.



More information about the Python-list mailing list