New submission from STINNER Victor:

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.

----------
files: keyword.patch
keywords: patch
messages: 199528
nosy: christian.heimes, haypo, pitrou
priority: normal
severity: normal
status: open
title: Reimplement the keyword module in C
type: performance
versions: Python 3.4
Added file: http://bugs.python.org/file32054/keyword.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19230>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to