From: Jeff A. <ja...@fa...> - 2015-06-09 05:10:29
|
Welcome to the project. I'd be happy to take a look. But I'm replying before I have. 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 have little doubt we should stay aligned with the CPython implementation names for 'str' and 'int'. The backward-compatibility arguments apply to us almost as strongly. Think about how the code looks when half the PyString references are intentional and half are historic (meant something else when written). And we get a long way just porting the CPython code to Java: a different name would make that harder I think. Jeff Jeff Allen On 06/06/2015 19:30, Antti Haapala wrote: > Hi all, > > I'd like to contribute substantially to the Jython 3 development. I am > far from a n00b with Java or Python, but I really didn't know anything > about the internals of Jython before ~2 weeks ago, thus I'd guess not > even of much use with Jython 2.7 development even if I wanted. But > Jython 3 changes would be something where I could be quite useful - > Alex Grönholm already merged some of my PRs to Jython 3 sandbox. > > ---- > > I have made a pull request that introduces PyBytes to Jython 3 - > basically what I did was to take the PyByteArray and removed the > mutating methods, changed the __repr__, etc. It was suggested that > Jeff Allen should review my PyBytes PR at > https://github.com/jython/jython3/pull/5/files - so it'd be nice if > Jeff you could review it. > > That commit also makes the compiler to produce bytes literals with > b'foo'; the bytes literals would be stored as "latin-1" string > constants in .class files. The code "works for me (tm)" in the > interactive interpreter. > > ---- > > Next, if the PyBytes were be accepted, I was thinking I'd want to try > merging PyInteger with PyLong; and PyString with PyUnicode if no one > else has it coming yet. > > However, naming things is still hard. What do you all think the Python > 3 str and int should be called on the Java side? CPython 3 still calls > them PyUnicode* and PyLong*, which makes sense, since their C-API is > consistent with these Python 2 types; and all usages of PyString* and > PyInt* should be reviewed for changes when porting extensions to Python 3. > > ---- > > Also, I've listed some to-do items in the Github issue tracker; how do > you feel about using the Github issue tracker at least for this in the > early phase of Jython 3 experimentation? Or should these too be in > Roundup? > > Any thoughts? > > -- > Antti Haapala |