[issue3982] support .format for bytes

2009-03-24 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: I also not fan on functions having different result type (format-bytes or str, it depends...). In 3.x, str.format() and bytes.format() would be two different methods on two different objects. I don't think there's any expectation that they have

[issue3982] support .format for bytes

2008-09-29 Thread STINNER Victor
STINNER Victor [EMAIL PROTECTED] added the comment: I don't think that b'...'.format() is a good idea. Programmers will continue to mix characters and bytes since .format() target are characters. -- nosy: +haypo ___ Python tracker [EMAIL PROTECTED]

[issue3982] support .format for bytes

2008-09-29 Thread Eric Smith
Eric Smith [EMAIL PROTECTED] added the comment: I don't think that b'...'.format() is a good idea. Programmers will continue to mix characters and bytes since .format() target are characters. b''.format() would return bytes, not a string. This is also how it works in 2.6. I'm also not sold

[issue3982] support .format for bytes

2008-09-29 Thread STINNER Victor
STINNER Victor [EMAIL PROTECTED] added the comment: I think Martin's suggesting of encoding back to ascii might be the best thing to do As I understand, you would like to use bytes as characters, like b'{code} {message}'.format(code=100, message='OK'). So why no using explicit conversion

[issue3982] support .format for bytes

2008-09-29 Thread Martin v. Löwis
Martin v. Löwis [EMAIL PROTECTED] added the comment: I think Martin's suggesting of encoding back to ascii might be the best thing to do As I understand, you would like to use bytes as characters, like b'{code} {message}'.format(code=100, message='OK'). So why no using explicit

[issue3982] support .format for bytes

2008-09-27 Thread Benjamin Peterson
New submission from Benjamin Peterson [EMAIL PROTECTED]: I just working on porting some networking code from 2.x to 3.x and it heavily uses string formatting. Since bytes don't support any kind of formatting, it's becoming tedious and inelegant to do it with +. Can .format be supported in bytes?

[issue3982] support .format for bytes

2008-09-27 Thread Eric Smith
Eric Smith [EMAIL PROTECTED] added the comment: Yes, it would be easy to add. Maybe bring this up on python-dev (or python-3000) to get consensus? Are we in feature freeze for 3.0? ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3982

[issue3982] support .format for bytes

2008-09-27 Thread Benjamin Peterson
Benjamin Peterson [EMAIL PROTECTED] added the comment: On Sat, Sep 27, 2008 at 12:33 PM, Eric Smith [EMAIL PROTECTED] wrote: Eric Smith [EMAIL PROTECTED] added the comment: Yes, it would be easy to add. Maybe bring this up on python-dev (or python-3000) to get consensus? Yes, that will

[issue3982] support .format for bytes

2008-09-27 Thread Martin v. Löwis
Martin v. Löwis [EMAIL PROTECTED] added the comment: I'm skeptical. What networking code specifically are you using, and what specifically does it use string formatting for? -- nosy: +loewis ___ Python tracker [EMAIL PROTECTED]

[issue3982] support .format for bytes

2008-09-27 Thread Benjamin Peterson
Benjamin Peterson [EMAIL PROTECTED] added the comment: On Sat, Sep 27, 2008 at 12:35 PM, Martin v. Löwis [EMAIL PROTECTED] wrote: Martin v. Löwis [EMAIL PROTECTED] added the comment: I'm skeptical. What networking code specifically are you using, and what specifically does it use string

[issue3982] support .format for bytes

2008-09-27 Thread Martin v. Löwis
Martin v. Löwis [EMAIL PROTECTED] 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

<    1   2