mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Small speedup
This commit is contained in:
parent
04a9a0e904
commit
bc288e8bbd
1 changed files with 2 additions and 1 deletions
|
@ -2,6 +2,7 @@ __all__ = ['deque', 'defaultdict', 'namedtuple']
|
||||||
|
|
||||||
from _collections import deque, defaultdict
|
from _collections import deque, defaultdict
|
||||||
from operator import itemgetter as _itemgetter
|
from operator import itemgetter as _itemgetter
|
||||||
|
from itertools import izip as _izip
|
||||||
from keyword import iskeyword as _iskeyword
|
from keyword import iskeyword as _iskeyword
|
||||||
import sys as _sys
|
import sys as _sys
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ def namedtuple(typename, field_names, verbose=False):
|
||||||
print template
|
print template
|
||||||
|
|
||||||
# Execute the template string in a temporary namespace
|
# Execute the template string in a temporary namespace
|
||||||
namespace = dict(itemgetter=_itemgetter)
|
namespace = dict(itemgetter=_itemgetter, zip=_izip)
|
||||||
try:
|
try:
|
||||||
exec template in namespace
|
exec template in namespace
|
||||||
except SyntaxError, e:
|
except SyntaxError, e:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue