Why not "list = ftplib.FTP.dir()" ?
rantingrick at gmail.com
Tue Feb 8 00:59:17 CET 2011
On Feb 7, 4:48 pm, Ian Kelly <ian.g.ke... at gmail.com> wrote:
> On Mon, Feb 7, 2011 at 3:26 PM, trylks <try... at gmail.com> wrote:
> > 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
> No need to use partial here. You can simplify that to:
> super(MyFTP, self).dir(lambda e: l.append(e.split()))
MyFTP.dir(self, lambda e: l.append(e.split()))
...super is not needed when you "know" the name of the object. And now
(without super) you can "see" the path of self just as Guido intended!
super can be super confusing to noobs.
More information about the Python-list