[Python-ideas] More things in the standard library equipped with __enter__ and __exit__

Tarek Ziadé ziade.tarek at gmail.com
Sun Jan 18 13:40:40 CET 2009


I have entered this yesterday : http://bugs.python.org/issue4972.
about the fact that ftplib.FTP could be
used in a "with" loop.

But I spotted that imaplib.IMAP4/IMAP4_SSL and smtplib.SMTP could be
equipped as well,
so an __exit__ call takes care of closing or quiting.

This change could be done together with some examples in the documentation.

If this sounds like a good idea, I can start a patch in #4972,


Tarek Ziadé | Association AfPy | www.afpy.org
Blog FR | http://programmation-python.org
Blog EN | http://tarekziade.wordpress.com/

More information about the Python-ideas mailing list