Neil Schemenauer added the comment:

I'm attaching v2 of my proposed patch.  This one is quite a bit better, IMHO.

- Introduce __ascii__ as a special method, like __str__ but required to exist 
only if an ASCII-only format exists.

- Extract PyString_Format from Python 2.7 and update it for PyBytes.

- %c only accepts integers, not single character strs, maybe should
  accept length one byte objects.

- add %a, should be useful for debugging

- %s calls __bytes__ or __ascii__, otherwise gives a TypeError, should
  eventually support buffer API

- number formats work as they do in Python 2.

----------
keywords: +needs review -patch
Added file: http://bugs.python.org/file33505/bytes_mod_v2.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20284>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to