Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>WHAT HAVE YOU TRIED? Python 3 allows you to use Unicode for all your function, class and variable names. Check it out, you just need to make sure you're using utf-8 for your script-- it's primarily a matter for your editor. Dealing gracefully with the mixed RTL/LTR issues is also your editor's problem. (The feature is discussed in <a href="http://www.python.org/dev/peps/pep-3131/" rel="nofollow">PEP 3131</a>)</p> <p>The python language does not have "dialects", i.e., alternative sets of keywords. If you are not satisfied with Urdu identifiers and you are determined to have a completely Urdu-language experience, you could write a preprocessor that maps Urdu "keywords" to the corresponding (English) python keyword. </p> <p>It shouldn't be too hard to wrap this kind of preprocessor around the interactive console and import modules, so that it works transparently to the user (and without recompiling python from source). If you can program and want to try this on for size, check out python's <a href="http://docs.python.org/2/library/code.html" rel="nofollow"><code>code</code></a> module. It's designed to read python source and send it on to be compiled and executed. You just step in and add a preprocessing step.</p> <p>I'd use a preprocessor for keywords and built-ins. But providing localized wrappers for your choice of common modules is even easier, actually. Let's demonstrate with a wrapper module <code>RE.py</code> that contains all <em>exported</em> identifiers of regular <code>re</code>, but renamed to upper case:</p> <pre><code>import re as _re for name in _re.__all__: locals()[name.upper()] = _re.__dict__[name] </code></pre> <p>That was it! You can now import this module and use it:</p> <pre><code>import RE docs = RE.SUB(r"\bEnglish\b", r"Urdu", docs) </code></pre> <p>Use Urdu words instead of uppercase (of course you need to specify each one individually) and you're on your way. As you say, whether all this is a good idea is a different question.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload