Re:Chinese Python: “Translating a programming language”
by arohner on Monday November 30, 2009 @07:41PM
(#969017)
I think that's a good argument against using character count as a measure of program length. i.e. translating 印 to print does not improve the program in any way, so it shouldn't score better in any measure of complexity.
Re:Chinese Python: “Translating a programming language”
by vorg on Monday November 30, 2009 @09:44PM
(#969135)
'print' is 5 characters long, 印 is 1 character long. Though in most fonts, CJK characters are twice as wide as Latin, so better make that 2 chars long. 5 chars vs 2 chars over an entire program adds up. In non-indentation languages, that can mean 3 lines can be put onto 1 line. Shorter programs are more readable, have less errors.
Re:Chinese Python: “Translating a programming language”
by Sandra_Snan on Tuesday December 01, 2009 @03:23PM
(#970664)
Shorter by token count, not byte count.
Because there's thousands of CJK characters to choose from, why not just use 印 instead of 印出 for 'print', or 如 instead of 如果 for 'if'? By using bracketing syntax instead of Python's indentation, we can cut down lines of code.
Here's your example using a terser style (the strings and comments would still be in English):
#!/usr/bin/env zhpy
# 檔名: while.py
數= 23, 運= 真
當(運){
}否 印'The while loop is over'印'Done'