with HTTPConnection as conn:

2010-11-18 Thread trylks
Hi!

Would it be possible to use a with statement with an HTTPConnection object?

I know it is not possible at this moment, it doesn't implement an
__exit__ method, at least in version 3.1.1. I was wondering if the
__exit__ method should do something more than conn.close(), something
really hard or impossible, or if there are more requisites to use the
with statement beside of implementing that method. So far it seems
easy, useful and not done yet, so I'm probably mistaken about
something, and wondering what may that be.

Thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Why not "list = ftplib.FTP.dir()" ?

2011-02-07 Thread trylks
I don't know if it is ftplib or just me, but something feels terribly wrong
in this:

from ftplib import FTP
> from functools import partial
>
> class MyFTP(FTP):
>   def dir(self):
> l = []
> super(MyFTP, self).dir(partial(lambda l, e: l.append(e.split()), l))
> return l
>

Unfortunately 'MLSD' is not available in the server I have to use. (I need
to get the list of folders and files modified since last access, hence
split).

Cheers.
-- 
http://mail.python.org/mailman/listinfo/python-list