

Finally, Python brings something interesting to the programming language. ChinesePython is a sort of translation work of the Python language into chinese. Not only the interpreter's user messages/errors/warnings but also the lanuguage itself, i.e. keywords, variable names, builtin functions and type methods. The idea is not new. However, I found python to be exceptionally suitable for this. The translated language remains as clear as the original python. Scripts written in chinesepython (in chinese of course) inherits the cleaness of python scripts. The well design of the python language seems to be universal even across diffenent languages and will be something worth one to ponder on. In the 6-th International Python Conference, Martin von Loewis had a nice one on I18N. In his paper he pointed out the posssiblity of localizing programming languages for the comfort (or not) of the programmer, i.e. translation of source code. Though in the paper he ruled out the subject by some examples which will bring ambiguities and confuse the interpreter, I think they could be solved by some extract effort of the parser. So I just say to myself, why not give it a try. And here is what I've got. There are two most commonly used charater encodings for chinese, Big5 and GB. To make that transparent to the programmer using chinesepython, the parser is modified such that it will detect "magic" comment strings ( "#--BIG5--" or "#--GBK--") in a program source and do a switch automatically. Also, the builtin stringobject has been changed to include an encoding flag, for the sake of correct display in the interative mode. I am not sure if this goes inline with PEP 263 but it may serve as an effort to try. Sorry I don't have time to maintain a foreign language version of this site, but since most of it concentrate on chinese, it might not interest anyone who cannot read them. However, I have maintained a small faq file in english for the chinesepython project lest someone courious should ask. It is listed below: ChinesePython FAQ What is ChinesePython ?

ChinesePython is a sort of translation work of the Python language into chinese. The most notable changes to the python language is that its keywords, variable names, builtin types and their methods are all tranlated into chinese. That enables a programmer to write chinese programs in python's style. Why are you doing this ?

For educational purpose I guess. Not too many people object that in the computer world (or in a much broader sense of modern technology), there is a fast growing gap between the 'haves' and 'have nots'. It is not sure to me what this so called 'digital gap' will eventually bring to our society, but in general it would be good if we could help those who formerly have no privilege access to the computer world to gain some knowledge of it, in the sense of mutual sharing. Python was a great language to teach (equally great in production, if not better ^_^ ), it had a CP4E project and a special interest group (SIG) that focus on education. My attempt is to extended it into the chinese society and teach those who has no programming tranings whatsoever to be able to learn it in their own native language. Well it is safe to say most western people has some kind of proficiency in the english language, it is not quite so in China. In my opinion, basic computer programming concepts are, not difficult at all, but turned out to be so difficult for some chinese people because they have to first break a language barrier before they can actually code their program. Not everybody learning computer will become a programmer, as an elementary introduction to computer programming, it is best to let them resolve to their own language for simple programming tasks. Python is great in education because its psedu-code like syntax enable the teacher to concentrat on basic concepts rather than language features. Chinespython inherits python's great design. My hope is that it can help to flatten the learning curve of computer programming for chinese people so teachers can teach better, and teach more. What version of Python are you using ?

I started from Python-2.1.1. I don't know the detail differences between 2.2 and 2.1 series in the core interpreter. A version based on Python-2.2 will be, if I have more time. Is Python and ChinesePython compatible ?

Yes and no. I suppose all Python code will run under ChinesePython. But not the other way round. Why Python ?

Python has a exceedingly clear syntax that after porting to chinese, the cleaness remains. Python is a modern, high level, interpreted, OO scripting language with many high level builtin data types and a extrememly powerful standard library and hundreds of extension modules. When porting python interpreter into chinese, all these can be reused. Why not ChineseRuby/ChinesePerl/ChinesePhp ... etc ?

I think that has to do with the way python treat code blocks. There are no curly braces in python and most of the codes just look like plain english pseduo-codes, this made possible that the source code written in chinesepython look much clearer and easier to understand. This rules out a host of languages like Perl/PHP/C/Java ... Since my major purpose for doing this is for education, a clear syntax outweights the purity of OO, the speed of execution, the flexiblity of condensation ... etc. I especaially dislike the syntax of perl because of its way of using cryptic punctuation symbols. All these '~/?2:1/\$^_'->@t stuff are horrible to beginners, especially those who never touched *nix shell or regular expression. So, it left me only one, Python. Trust me, this one is good. Why chinese ?

Well that is what I know. A Korean could have made a KoreanPython if he cares. Can I made a, say, KlingonPython ?

Sure. The job is just a little more than translation and most of the time you spent is on picking the right word rather than acutal coding. What has beem changed to the python interpreter, actually ?

Mainly the parser. Now valid python source could be full 8-bit string. Also, I added a code identification magic comment string ("#--GBK--" and "#--BIG5--) for the parser to distinguish different source file encodings. Change the stringobject, added an encoding flag carried by each string. So in interactive mode, the user messages/warnings ... would be displayed in the right encoding. Then the builtin methods of all data types. Plan to translate the standar library into chinese as well. Is this a fork ?

I don't know. Perhaps it could merge back to the main tree if someone come up with an idea of a general multilanguage programming framework for python. Ported platform ?

I tried Linux (guess that means all *nix with gcc) and Windows. Not sure about others. For the windows version, since the DOS prompt under windows can only display chinese but not input them, I have to include the wxPython with the windows installer and use my own 'pyshell.py' program to bring up the interactive windows. IDLE will work, but since Tk uses unicode so it occasionally displays strange characters and the syntax highlighting is incorrect. What license ?

Python license, of course.







