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

R. David Murray rdmurray at bitdance.com
Wed Mar 18 16:25:31 CET 2009


John Roth <johnroth1 at gmail.com> wrote:
> 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.

Submitting an issue to the tracker with this request would probably be a
good idea.  Even better if you include a suggested patch.

--
R. David Murray           http://www.bitdance.com




More information about the Python-list mailing list