From: Antti H. <an...@ha...> - 2015-06-09 09:06:59
|
On 9 June 2015 at 08:10, Jeff Allen <ja...@fa...> wrote: BaseBytes was written with the idea that a PyBytes would eventually descend > from it. I probably made some mistakes in doing that, but you should have > found basically everything in place. A large missing piece is string > interpolation (% and format): CPython added that to 'bytes' (and > 'bytearray'?) just recently. I recommend that be adapted from Jython 2 > PyString. > I didn't do the `%` interpolation yet as it is very complicated, and so far not very important as there shouldn't be much any code using it yet, so it is not very important for testing in early phases. Unfortunately the formatting language differs from thestr language. And there still is no `.format` and afaik will not be: Python 3.5.0a4+ (default:a3f2b171b765, May 19 2015, 16:14:41) [GCC 4.9.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> bytearray(b'123%b') % b'foo' bytearray(b'123foo') >>> b'123%b' % b'foo' b'123foo' >>> b'123%b'.format Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'bytes' object has no attribute 'format' -- Antti Haapala |