[issue3982] support .format for bytes

Martin v. Löwis report at bugs.python.org
Sat Sep 27 20:42:04 CEST 2008


Martin v. Löwis <martin at v.loewis.de> added the comment:

> I'm working on the tests for ftplib. [1] The dummy server uses string
> formatting to build responses.

I see. I propose to add a method push_string, defined as

  def push_string(self, s):
      self.push(s.encode("ascii")

In FTP, the responses are, by definition, ASCII-encoded strings.
The proper way to generate them is to make a string, then encode it.

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


More information about the Python-bugs-list mailing list