Please help.

John Ladasky john_ladasky at sbcglobal.net
Mon Feb 9 14:06:32 EST 2015


On Monday, February 9, 2015 at 10:26:47 AM UTC-8, Dave Angel wrote:

> That will help him with the functions.  But not with the keywords.  The 
> OP didn't specify Python version, but in 3.x, print() is a function, and 
> can be rebound.  Since he said keyword, he's either mistaken, or he's 
> running 2.x
> 
> But any real keywords, are a real problem.  For example, changing 'if' 
> to some other string.

That's true, Dave, he did say "key words".  I only helped him with his example of a Python built-in function.  And you're right, shadowing key words is currently not possible.

Are you familiar with a program known as a "talk filter"?  They've been around for decades.  

http://www.hyperrealm.com/talkfilters/talkfilters.html

Talk filters are usually used for off-color humor, rather than for serious purposes.  A talk filter processes a text stream, line-by-line, typically in a chat room setting.  A dictionary of words, and their replacements, is defined.  

I could see a talk filter being used to translate a non-English version of Python into standard English Python code.  I suppose that a hook for a talk filter could be added to the interpreter itself.  It wouldn't be easy to change word order to accommodate the syntax of another language, but words themselves could be altered.



More information about the Python-list mailing list