Moving from Python 2 to Python 3: A 4 page "cheat sheet"

Mark Summerfield list at qtrac.plus.com
Wed Dec 2 11:22:59 EST 2009


On Dec 2, 11:31 am, "Martin P. Hellwig" <martin.hell... at dcuktec.org>
wrote:
> MarkSummerfieldwrote:
>
> <cut>> It is available as a free PDF download (no registration or anything)
> > from InformIT's website. Here's the direct link:
> >http://ptgmedia.pearsoncmg.com/imprint_downloads/informit/promotions/...
>
> <cut>
> Very handy! Am I wrong in assuming that you forgot to include that
> file() is gone in favour of open()?

No you are not wrong in assuming that I forgot that:-(

My lame excuse is that file() was introduced for isinstance() testing
and similar, and never really as a replacement for open().

Anyway, I have now added:

    fh = file(fname, mode) | fh = open(fname, mode)

I've sent a new PDF with this change to InformIT, so hopefully it'll
become available soon from
http://www.informit.com/promotions/promotion.aspx?promo=13751



More information about the Python-list mailing list