473,909 Members | 4,721 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python in Chinese

Back in May, there was quite an extensive discussion of whether or not
Python should support Unicode identifiers (with the final result being
that this would be supported in Python 3). In my periodic googling
for pyparsing users, I stumbled upon Zhpy, a preprocessor that renders
on the fly Chinese Python keywords and indentifiers written using
traditional Chinese characters into ASCII counterparts, and then
executes the resulting script. I was very intrigued at the idea, and
I thought back to Martin v. Löwis's PEP. The Zhpy approach will work
with current versions of Python (going back to 2.3, since pyparsing
requires that version).

You can view examples at the pyparsing "Who's Using Pyparsing" wiki
page - http://pyparsing.wikispaces.com/WhosUsingPyparsing#Zhpy.

Given the breadth of response to Martin v. Löwis's post, I'm curious
as to what the reaction might be to something like Zhpy.

-- Paul

Aug 13 '07 #1
1 2443
Paul McGuire schrieb:
Back in May, there was quite an extensive discussion of whether or not
Python should support Unicode identifiers (with the final result being
that this would be supported in Python 3). In my periodic googling
for pyparsing users, I stumbled upon Zhpy, a preprocessor that renders
on the fly Chinese Python keywords and indentifiers written using
traditional Chinese characters into ASCII counterparts, and then
executes the resulting script.
Interesting!

Notice what they do to the identifiers - when translating to "English",
the just number them. I wonder what this will do to backtraces,
cross-module imports, and such...

With Python 3, they can restrict themselves to just translating
keywords, and leave all identifiers in place.

Regards,
Martin
Aug 13 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2680
by: Achim Domma | last post by:
Hi, I need to convert Big5 or GB encoded chinese strings to unicode. It would be also nice to be able to detect the encoding of the original string. Search with groups.google.com I found some links to different projects but they all look not very active. Can somebody give me a short overview of the status of processing chinese texts with python? regards, Achim
57
4298
by: John Howard | last post by:
I've sent several messages over the last year asking about python - Who teaches python? Is python losing steam? etc. I have noticed, eg, the declinng number of books at my local borders. The last time I visited a borders (last week), there was 1 (sic) book about python on the shelve compared to dozens on perl & java! On my last inquiry about who teaching python, I got two, maybe three, responses. I really want to see python succeed! It's...
1
7050
by: Posadas, Dennis | last post by:
Hi, I've done some google searching w/c referred me to a couple of articles on unicode, but I'm looking for something really simple - not for a web application. See my sample code below. Any ideas how to convert it to display maybe Simplified Chinese ? Rgds,
1
2995
by: Anthony Liu | last post by:
The following 4 lines of code parses an XML document very well if the XML document contains only English words. But when I insert one Chinese character into the XML document, then Python starts to complain when it hits the Chinese character, saying that it is an invalid token and thus it is not well-formed. This is the complaint of Python:
12
4451
by: xiong.xu.cn | last post by:
Hi there, I'm new to python and I'm from the java world. Though I love to learn python, I'm not very comfortable with the python documentation. Because when i read jdk doc, i can see the class hierachy, class member, class methods etc in html docs. It's very easy for me to understand the Java language. But in python, i find it kind of inconvient.
7
2158
by: kernel1983 | last post by:
I'm try to build a bundle on OS X, so I write a simple python script for a test: #!/usr/bin/env python import EasyDialogs EasyDialogs.Message("Hello,Mac!") This runs OK,but when I try to replace "Hello,Mac!" with chinese, it can't be display rightly.
34
4413
by: Victor Kryukov | last post by:
Hello list, our team is going to rewrite our existing web-site, which has a lot of dynamic content and was quickly prototyped some time ago. Today, as we get better idea of what we need, we're going to re-write everything from scratch. Python is an obvious candidate for our team: everybody knows it, everybody likes it, it has *real* objects, nice clean syntax etc.
12
2761
by: Steve Howell | last post by:
The never-ending debate about PEP 3131 got me thinking about natural languages with respect to Python, and I have a bunch of mostly simple observations (some factual, some anecdotal). I present these mostly as food for thought, but I do make my own continent-by-continent recommendations at the bottom of the email. (My own linguistic biases are also disclosed at the bottom of the email.) Nationality of various technologists who use...
13
3950
by: Liang Chen | last post by:
Hope you all had a nice weekend. I have a question that I hope someone can help me out. I want to run a Python program that uses Tkinter for the user interface (GUI). The program allows me to type Chinese characters, but neverthelss is unable to show them up on screen. The follow is some of the error message I received after I logged off the program: "Could not write output: <type "exceptions: UnicodeEncodeError'>, 'ascii' codec can't...
0
10035
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11346
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10919
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10538
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8097
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7248
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5938
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6138
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3357
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.