I am trying to really understand what is happening in this line of python to get it to pull the incoming data to a string instead of writing it to an outfile.
ftp.retrlines("RETR " + filename, lambda s, w=outfile.write: w(s+"\n"))
It looks like retrlines is getting a command and a callback -- but then there is an additional 3rd argument. What is it doing?
Also, I understand lambdas as explained here (which look very similar to javascript anonymous function callbacks) but don't see how to apply that to this case, where lamda s is defined in the second argument Why are Python lambdas useful?
There are too many unfamilar things happening in this python code. Can someone explain what is happening in this line.