Message199528
To speedup Python startup, I propose to reimplement the keyword module in C. Attached patch implements it.
* Remove Lib/keyword.py
* Add Tools/scripts/keyword.py: script to build Modules/keyword.h
* The new module is Modules/keyword.c
I chose to change the keyword.kwlist type from list to tuple. The documentation only says they that kwlist is a "Sequence":
http://docs.python.org/dev/library/keyword.html#keyword.kwlist
The keyword is now used by the collections module in the implementation of namedtuple.
The keyword module is trivial: it only contains a sequence of strings and a method checking if a string is part of this sequence. It would be simpler to add this to an existing module. I suppose that a new module was added for technical reasons. |
|
Date |
User |
Action |
Args |
2013-10-12 00:33:11 | vstinner | set | recipients:
+ vstinner, pitrou, christian.heimes |
2013-10-12 00:33:11 | vstinner | set | messageid: <1381537991.31.0.762180400628.issue19230@psf.upfronthosting.co.za> |
2013-10-12 00:33:11 | vstinner | link | issue19230 messages |
2013-10-12 00:33:10 | vstinner | create | |
|