Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
34ae04f7
Kaydet (Commit)
34ae04f7
authored
Ara 26, 2018
tarafından
Andrew Svetlov
Kaydeden (comit)
Ethan Furman
Ara 26, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Speed-up building enums by value, e.g. http.HTTPStatus(200) (#11318)
bpo-35585: Speed up enum by-value lookup
üst
3a81076b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
enum.py
Lib/enum.py
+4
-2
2018-12-26-02-28-00.bpo-35585.Lkzd3Z.rst
...S.d/next/Library/2018-12-26-02-28-00.bpo-35585.Lkzd3Z.rst
+1
-0
No files found.
Lib/enum.py
Dosyayı görüntüle @
34ae04f7
...
@@ -563,8 +563,10 @@ class Enum(metaclass=EnumMeta):
...
@@ -563,8 +563,10 @@ class Enum(metaclass=EnumMeta):
# by-value search for a matching enum member
# by-value search for a matching enum member
# see if it's in the reverse mapping (for hashable values)
# see if it's in the reverse mapping (for hashable values)
try
:
try
:
if
value
in
cls
.
_value2member_map_
:
return
cls
.
_value2member_map_
[
value
]
return
cls
.
_value2member_map_
[
value
]
except
KeyError
:
# Not found, no need to do long O(n) search
pass
except
TypeError
:
except
TypeError
:
# not there, now do long search -- O(n) behavior
# not there, now do long search -- O(n) behavior
for
member
in
cls
.
_member_map_
.
values
():
for
member
in
cls
.
_member_map_
.
values
():
...
...
Misc/NEWS.d/next/Library/2018-12-26-02-28-00.bpo-35585.Lkzd3Z.rst
0 → 100644
Dosyayı görüntüle @
34ae04f7
Speed-up building enums by value, e.g. http.HTTPStatus(200).
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment