[docs] Defining new keyword (extension of default keywords) in Python 3.3.2

georgegadvani at hsbc.com.hk georgegadvani at hsbc.com.hk
Thu Aug 15 06:23:30 CEST 2013


I did some research and found this article maybe of use, 

http://stackoverflow.com/questions/2315044/how-to-generate-a-module-object-from-a-code-object-in-python
Thus, I followed the example but not successful. The screen-dumps below 
illustrate the problem (iii)  in my last message.




Can you advice what's the right syntax for exec in this case ?



From:
George G ADVANI/HBAP/HSBC
To:
docs at python.org
Date:
08/15/2013 11:08 AM
Subject:
Defining new keyword (extension of default keywords) in Python 3.3.2


Hi team,

Actually this is not a bug but a question.  I started using Python 
recently on building prototype analytics. 
FYI, my Python version is 3.3.2 &  I used  IPython/WinPython in 
development.
 


Basic packages are all installed, e.g.
numpy version is 1.7.1



scipy version is 0.12.0


Path & PythonPath settings as below:-



My question is related to this thread somebody posts on adding new 
keywords in Python.
http://stackoverflow.com/questions/214881/can-you-add-new-statements-to-pythons-syntax

Looking at the suggestions, there are couple of ways to achieve this and I 
prefer this way since it sounds easiest:-



However, I cannot simply use these statements owing to the following 
reasons:-

(i)  the new package is replaced by Types package;
(ii) In the Types Package (checking on documentation), there is nothing 
like types.module(  ....). How to re-write the statements ?





(iii) When I execute this line 
    exec data in mod.__dict__

I got  message like syntax error   highlighting  the word "data" 


My understanding is that this support group is runned on voluntary basis. 
Grateful if somebody may help and revert with valid examples that
can run on Python 3.3.2.

Thx & Rgds,

George Advani




-----------------------------------------
*******************************************************************
This e-mail is confidential. It may also be legally privileged.
If you are not the addressee you may not copy, forward, disclose
or use any part of it. If you have received this message in error,
please delete it and all copies from your system and notify the
sender immediately by return e-mail.

Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability
for any errors or omissions.
*******************************************************************
"SAVE PAPER - THINK BEFORE YOU PRINT!" 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20130815/2ed55434/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 18418 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/docs/attachments/20130815/2ed55434/attachment-0008.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 12546 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/docs/attachments/20130815/2ed55434/attachment-0009.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 10399 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/docs/attachments/20130815/2ed55434/attachment-0010.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 10512 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/docs/attachments/20130815/2ed55434/attachment-0011.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 13790 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/docs/attachments/20130815/2ed55434/attachment-0012.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 16600 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/docs/attachments/20130815/2ed55434/attachment-0013.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 5861 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/docs/attachments/20130815/2ed55434/attachment-0014.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 9130 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/docs/attachments/20130815/2ed55434/attachment-0015.gif>


More information about the docs mailing list