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
32062e9b
Kaydet (Commit)
32062e9b
authored
Ock 01, 2011
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make it easier to extend OrderedDict without breaking it.
üst
60db4675
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
collections.py
Lib/collections.py
+2
-2
test_collections.py
Lib/test/test_collections.py
+8
-0
No files found.
Lib/collections.py
Dosyayı görüntüle @
32062e9b
...
...
@@ -52,7 +52,7 @@ class OrderedDict(dict, MutableMapping):
self
.
__root
=
root
=
_proxy
(
self
.
__hardroot
)
root
.
prev
=
root
.
next
=
root
self
.
__map
=
{}
self
.
update
(
*
args
,
**
kwds
)
self
.
__
update
(
*
args
,
**
kwds
)
def
__setitem__
(
self
,
key
,
value
,
dict_setitem
=
dict
.
__setitem__
,
proxy
=
_proxy
,
Link
=
_Link
):
...
...
@@ -171,7 +171,7 @@ class OrderedDict(dict, MutableMapping):
size
+=
sizeof
(
self
.
__root
)
*
n
# proxy objects
return
size
update
=
MutableMapping
.
update
update
=
__update
=
MutableMapping
.
update
pop
=
MutableMapping
.
pop
keys
=
MutableMapping
.
keys
values
=
MutableMapping
.
values
...
...
Lib/test/test_collections.py
Dosyayı görüntüle @
32062e9b
...
...
@@ -1012,6 +1012,14 @@ class TestOrderedDict(unittest.TestCase):
od
=
OrderedDict
(
**
d
)
self
.
assertGreater
(
sys
.
getsizeof
(
od
),
sys
.
getsizeof
(
d
))
def
test_override_update
(
self
):
# Verify that subclasses can override update() without breaking __init__()
class
MyOD
(
OrderedDict
):
def
update
(
self
,
*
args
,
**
kwds
):
raise
Exception
()
items
=
[(
'a'
,
1
),
(
'c'
,
3
),
(
'b'
,
2
)]
self
.
assertEqual
(
list
(
MyOD
(
items
)
.
items
()),
items
)
class
GeneralMappingTests
(
mapping_tests
.
BasicTestMappingProtocol
):
type2test
=
OrderedDict
...
...
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