2to3 does not fix FileType from types Module; no replacement?

John Roth johnroth1 at gmail.com
Wed Mar 18 10:03:59 EDT 2009


On Mar 18, 5:48 am, Benjamin Peterson <benja... at python.org> wrote:
>  <mkieverpy <at> tlink.de> schrieb:
>
> > and I could not find a replacement for 'FileType'.
> > Has this been overlooked?
>
> > Found this thread which does not mention FileType:
> >http://mail.python.org/pipermail/stdlib-sig/2008-April/thread.html#172
>
> > I guess I just did not see something simple.
> > Anyone with a hint?
>
> That's because this isn't simple. Python 3 doesn't have one file type. It has
> several different kinds of streams in the io module. If you're checking for a
> file type, you'll want to use isinstance(some_file, io.IOBase). If you're
> inheriting form it, I suggest you look at the io module's classes.

Nontheless, a warning would be helpful, possibly with some doc.

John Roth



More information about the Python-list mailing list