Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 51863b7

Browse filesBrowse files
authored
gh-109653: Improve enum import time by avoiding import of functools (GH-109789)
1 parent e8be0c9 commit 51863b7
Copy full SHA for 51863b7

File tree

2 files changed

+3
-3
lines changed
Filter options

2 files changed

+3
-3
lines changed

‎Lib/enum.py

Copy file name to clipboardExpand all lines: Lib/enum.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import sys
22
import builtins as bltns
33
from types import MappingProxyType, DynamicClassAttribute
4-
from operator import or_ as _or_
5-
from functools import reduce
64

75

86
__all__ = [
@@ -1884,7 +1882,8 @@ def __call__(self, enumeration):
18841882
missed = [v for v in values if v not in member_values]
18851883
if missed:
18861884
missing_names.append(name)
1887-
missing_value |= reduce(_or_, missed)
1885+
for val in missed:
1886+
missing_value |= val
18881887
if missing_names:
18891888
if len(missing_names) == 1:
18901889
alias = 'alias %s is missing' % missing_names[0]
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Reduce the import time of :mod:`enum` by over 50%. Patch by Alex Waygood.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.