From: <bc...@wo...> - 2001-04-04 10:40:06
|
On Mon, 2 Apr 2001 16:40:40 -0500 (CDT), you wrote: >Hello all, > >I have a question about the builtins chr(). The Python Library >Reference for 2.1b2 says it "Return a string of one character whose ASCII >code is the integer i, e.g., chr(97) returns the string 'a'. This is the >inverse of ord(). The argument must be in the range [0..255], inclusive; >ValueError will be raised if i is outside that range." > >When interpreting this for Jython, the obvious catches are that it >specifies "range [0..255]", and raises ValueError for i outsite this >range. > >This doesn't really seem to apply considering how Jython only has the >2-byte character string. Different behavior for Jython's builtin chr() >makes sense. However, is this difference in chr() official? I think it is. As long as CPython strings are 8-bits, I expect this difference to stand. >I didn't >see a comment on http://jython.sourceforge.net/docs/differences.html about >this, I'll add an item about the chr() difference. >and I wanted to be sure before committing it to paper for a Jython >publication (and risking a ValueError being raised in Jython2.1final or >2.2). It will not throw ValueErrors for 2.1 final. The string/unicode split in CPython is not pleasing and will perhaps change in later versions of CPython. If ever that happens, Jython may change too, but only in order to reduce the differences between the two implementations. regards, finn |