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
ffcd8490
Kaydet (Commit)
ffcd8490
authored
May 13, 2015
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Reduce the overhead in functools.total_ordering by localizing NotImplemented.
(Sugguested by Serhiy Storchaka)
üst
276e9c84
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
functools.py
Lib/functools.py
+12
-12
No files found.
Lib/functools.py
Dosyayı görüntüle @
ffcd8490
...
...
@@ -94,80 +94,80 @@ def wraps(wrapped,
# infinite recursion that could occur when the operator dispatch logic
# detects a NotImplemented result and then calls a reflected method.
def
_gt_from_lt
(
self
,
other
):
def
_gt_from_lt
(
self
,
other
,
NotImplemented
=
NotImplemented
):
'Return a > b. Computed by @total_ordering from (not a < b) and (a != b).'
op_result
=
self
.
__lt__
(
other
)
if
op_result
is
NotImplemented
:
return
op_result
return
not
op_result
and
self
!=
other
def
_le_from_lt
(
self
,
other
):
def
_le_from_lt
(
self
,
other
,
NotImplemented
=
NotImplemented
):
'Return a <= b. Computed by @total_ordering from (a < b) or (a == b).'
op_result
=
self
.
__lt__
(
other
)
return
op_result
or
self
==
other
def
_ge_from_lt
(
self
,
other
):
def
_ge_from_lt
(
self
,
other
,
NotImplemented
=
NotImplemented
):
'Return a >= b. Computed by @total_ordering from (not a < b).'
op_result
=
self
.
__lt__
(
other
)
if
op_result
is
NotImplemented
:
return
op_result
return
not
op_result
def
_ge_from_le
(
self
,
other
):
def
_ge_from_le
(
self
,
other
,
NotImplemented
=
NotImplemented
):
'Return a >= b. Computed by @total_ordering from (not a <= b) or (a == b).'
op_result
=
self
.
__le__
(
other
)
if
op_result
is
NotImplemented
:
return
op_result
return
not
op_result
or
self
==
other
def
_lt_from_le
(
self
,
other
):
def
_lt_from_le
(
self
,
other
,
NotImplemented
=
NotImplemented
):
'Return a < b. Computed by @total_ordering from (a <= b) and (a != b).'
op_result
=
self
.
__le__
(
other
)
if
op_result
is
NotImplemented
:
return
op_result
return
op_result
and
self
!=
other
def
_gt_from_le
(
self
,
other
):
def
_gt_from_le
(
self
,
other
,
NotImplemented
=
NotImplemented
):
'Return a > b. Computed by @total_ordering from (not a <= b).'
op_result
=
self
.
__le__
(
other
)
if
op_result
is
NotImplemented
:
return
op_result
return
not
op_result
def
_lt_from_gt
(
self
,
other
):
def
_lt_from_gt
(
self
,
other
,
NotImplemented
=
NotImplemented
):
'Return a < b. Computed by @total_ordering from (not a > b) and (a != b).'
op_result
=
self
.
__gt__
(
other
)
if
op_result
is
NotImplemented
:
return
op_result
return
not
op_result
and
self
!=
other
def
_ge_from_gt
(
self
,
other
):
def
_ge_from_gt
(
self
,
other
,
NotImplemented
=
NotImplemented
):
'Return a >= b. Computed by @total_ordering from (a > b) or (a == b).'
op_result
=
self
.
__gt__
(
other
)
return
op_result
or
self
==
other
def
_le_from_gt
(
self
,
other
):
def
_le_from_gt
(
self
,
other
,
NotImplemented
=
NotImplemented
):
'Return a <= b. Computed by @total_ordering from (not a > b).'
op_result
=
self
.
__gt__
(
other
)
if
op_result
is
NotImplemented
:
return
op_result
return
not
op_result
def
_le_from_ge
(
self
,
other
):
def
_le_from_ge
(
self
,
other
,
NotImplemented
=
NotImplemented
):
'Return a <= b. Computed by @total_ordering from (not a >= b) or (a == b).'
op_result
=
self
.
__ge__
(
other
)
if
op_result
is
NotImplemented
:
return
op_result
return
not
op_result
or
self
==
other
def
_gt_from_ge
(
self
,
other
):
def
_gt_from_ge
(
self
,
other
,
NotImplemented
=
NotImplemented
):
'Return a > b. Computed by @total_ordering from (a >= b) and (a != b).'
op_result
=
self
.
__ge__
(
other
)
if
op_result
is
NotImplemented
:
return
op_result
return
op_result
and
self
!=
other
def
_lt_from_ge
(
self
,
other
):
def
_lt_from_ge
(
self
,
other
,
NotImplemented
=
NotImplemented
):
'Return a < b. Computed by @total_ordering from (not a >= b).'
op_result
=
self
.
__ge__
(
other
)
if
op_result
is
NotImplemented
:
...
...
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