[issue4972] let's equip ftplib.FTP with __enter__ and __exit__

Giampaolo Rodola' report at bugs.python.org
Sun May 9 21:25:45 CEST 2010


Giampaolo Rodola' <g.rodola at gmail.com> added the comment:

> Magic methods usually don’t have docstrings, since they implement one 
> operation that is described in one place (think __len__ vs. len).

Agreed, I only left it since it was there in the first place.

> What did you add a cmd_noop method that does the same thing as
> cmd_user for?

Basically all DummyFTPHandler commands are no-ops except pasv, port, retr, stor and some others. There's no real reason why I added NOOP except for consistency with the FTP procol.
What I wanted to do in the new tests was just sending a command and receive a response and the "correct" way to do that in FTP is using NOOP.

> Will the change from handler to handler_instance not break 
> third-party code?

Not sure what you mean by "third party code" but it shouldn't break the existing tests if that's what you're worried about.
I did that because the original server behavior was to accept only one connection and I needed to connect more than one client in the same test.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4972>
_______________________________________


More information about the Python-bugs-list mailing list