More things in the standard library equipped with __enter__ and __exit__

Hello, 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, Regards Tarek -- Tarek Ziadé | Association AfPy | www.afpy.org Blog FR | http://programmation-python.org Blog EN | http://tarekziade.wordpress.com/

+1 on both On Sun, Jan 18, 2009 at 7:40 AM, Tarek Ziadé <ziade.tarek@gmail.com> wrote:
-- Read my blog! I depend on your acceptance of my opinion! I am interesting! http://techblog.ironfroggy.com/ Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy

On Sun, Jan 18, 2009 at 04:40, Tarek Ziadé <ziade.tarek@gmail.com> wrote:
They should be separate patches, but yes, more context managers are a good thing (we are not calling them "'with' loops" since they don't loop =). -Brett

+1 on both On Sun, Jan 18, 2009 at 7:40 AM, Tarek Ziadé <ziade.tarek@gmail.com> wrote:
-- Read my blog! I depend on your acceptance of my opinion! I am interesting! http://techblog.ironfroggy.com/ Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy

On Sun, Jan 18, 2009 at 04:40, Tarek Ziadé <ziade.tarek@gmail.com> wrote:
They should be separate patches, but yes, more context managers are a good thing (we are not calling them "'with' loops" since they don't loop =). -Brett
participants (3)
-
Brett Cannon
-
Calvin Spealman
-
Tarek Ziadé