Re: PyBytes for Jython 3 waiting for review and other Jython 3 dev related questions

Antti Haapala <[email protected]>
Newsgroups gmane.comp.lang.jython.devel
Message-ID <CA+HSgbJoF9gdBGxcz5dOx1a3kGaw+o5wmnyzgacZ-XXGjgt5kw@mail.gmail.com>
On 9 June 2015 at 08:10, Jeff Allen <[email protected]> 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

------------------------------------------------------------------------------

_______________________________________________
Jython-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.