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
c46759ad
Kaydet (Commit)
c46759ad
authored
Mar 22, 2011
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #11333: Add __slots__ to the collections ABCs.
üst
7969d333
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
abc.py
Lib/collections/abc.py
+26
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/collections/abc.py
Dosyayı görüntüle @
c46759ad
...
@@ -46,6 +46,8 @@ dict_proxy = type(type.__dict__)
...
@@ -46,6 +46,8 @@ dict_proxy = type(type.__dict__)
class
Hashable
(
metaclass
=
ABCMeta
):
class
Hashable
(
metaclass
=
ABCMeta
):
__slots__
=
()
@abstractmethod
@abstractmethod
def
__hash__
(
self
):
def
__hash__
(
self
):
return
0
return
0
...
@@ -63,6 +65,8 @@ class Hashable(metaclass=ABCMeta):
...
@@ -63,6 +65,8 @@ class Hashable(metaclass=ABCMeta):
class
Iterable
(
metaclass
=
ABCMeta
):
class
Iterable
(
metaclass
=
ABCMeta
):
__slots__
=
()
@abstractmethod
@abstractmethod
def
__iter__
(
self
):
def
__iter__
(
self
):
while
False
:
while
False
:
...
@@ -78,6 +82,8 @@ class Iterable(metaclass=ABCMeta):
...
@@ -78,6 +82,8 @@ class Iterable(metaclass=ABCMeta):
class
Iterator
(
Iterable
):
class
Iterator
(
Iterable
):
__slots__
=
()
@abstractmethod
@abstractmethod
def
__next__
(
self
):
def
__next__
(
self
):
raise
StopIteration
raise
StopIteration
...
@@ -109,6 +115,8 @@ Iterator.register(zip_iterator)
...
@@ -109,6 +115,8 @@ Iterator.register(zip_iterator)
class
Sized
(
metaclass
=
ABCMeta
):
class
Sized
(
metaclass
=
ABCMeta
):
__slots__
=
()
@abstractmethod
@abstractmethod
def
__len__
(
self
):
def
__len__
(
self
):
return
0
return
0
...
@@ -123,6 +131,8 @@ class Sized(metaclass=ABCMeta):
...
@@ -123,6 +131,8 @@ class Sized(metaclass=ABCMeta):
class
Container
(
metaclass
=
ABCMeta
):
class
Container
(
metaclass
=
ABCMeta
):
__slots__
=
()
@abstractmethod
@abstractmethod
def
__contains__
(
self
,
x
):
def
__contains__
(
self
,
x
):
return
False
return
False
...
@@ -137,6 +147,8 @@ class Container(metaclass=ABCMeta):
...
@@ -137,6 +147,8 @@ class Container(metaclass=ABCMeta):
class
Callable
(
metaclass
=
ABCMeta
):
class
Callable
(
metaclass
=
ABCMeta
):
__slots__
=
()
@abstractmethod
@abstractmethod
def
__call__
(
self
,
*
args
,
**
kwds
):
def
__call__
(
self
,
*
args
,
**
kwds
):
return
False
return
False
...
@@ -164,6 +176,8 @@ class Set(Sized, Iterable, Container):
...
@@ -164,6 +176,8 @@ class Set(Sized, Iterable, Container):
then the other operations will automatically follow suit.
then the other operations will automatically follow suit.
"""
"""
__slots__
=
()
def
__le__
(
self
,
other
):
def
__le__
(
self
,
other
):
if
not
isinstance
(
other
,
Set
):
if
not
isinstance
(
other
,
Set
):
return
NotImplemented
return
NotImplemented
...
@@ -275,6 +289,8 @@ Set.register(frozenset)
...
@@ -275,6 +289,8 @@ Set.register(frozenset)
class
MutableSet
(
Set
):
class
MutableSet
(
Set
):
__slots__
=
()
@abstractmethod
@abstractmethod
def
add
(
self
,
value
):
def
add
(
self
,
value
):
"""Add an element."""
"""Add an element."""
...
@@ -348,6 +364,8 @@ MutableSet.register(set)
...
@@ -348,6 +364,8 @@ MutableSet.register(set)
class
Mapping
(
Sized
,
Iterable
,
Container
):
class
Mapping
(
Sized
,
Iterable
,
Container
):
__slots__
=
()
@abstractmethod
@abstractmethod
def
__getitem__
(
self
,
key
):
def
__getitem__
(
self
,
key
):
raise
KeyError
raise
KeyError
...
@@ -451,6 +469,8 @@ ValuesView.register(dict_values)
...
@@ -451,6 +469,8 @@ ValuesView.register(dict_values)
class
MutableMapping
(
Mapping
):
class
MutableMapping
(
Mapping
):
__slots__
=
()
@abstractmethod
@abstractmethod
def
__setitem__
(
self
,
key
,
value
):
def
__setitem__
(
self
,
key
,
value
):
raise
KeyError
raise
KeyError
...
@@ -530,6 +550,8 @@ class Sequence(Sized, Iterable, Container):
...
@@ -530,6 +550,8 @@ class Sequence(Sized, Iterable, Container):
__getitem__, and __len__.
__getitem__, and __len__.
"""
"""
__slots__
=
()
@abstractmethod
@abstractmethod
def
__getitem__
(
self
,
index
):
def
__getitem__
(
self
,
index
):
raise
IndexError
raise
IndexError
...
@@ -575,12 +597,16 @@ class ByteString(Sequence):
...
@@ -575,12 +597,16 @@ class ByteString(Sequence):
XXX Should add all their methods.
XXX Should add all their methods.
"""
"""
__slots__
=
()
ByteString
.
register
(
bytes
)
ByteString
.
register
(
bytes
)
ByteString
.
register
(
bytearray
)
ByteString
.
register
(
bytearray
)
class
MutableSequence
(
Sequence
):
class
MutableSequence
(
Sequence
):
__slots__
=
()
@abstractmethod
@abstractmethod
def
__setitem__
(
self
,
index
,
value
):
def
__setitem__
(
self
,
index
,
value
):
raise
IndexError
raise
IndexError
...
...
Misc/NEWS
Dosyayı görüntüle @
c46759ad
...
@@ -84,6 +84,8 @@ Library
...
@@ -84,6 +84,8 @@ Library
-
Issue
#
11371
:
Mark
getopt
error
messages
as
localizable
.
Patch
by
Filip
-
Issue
#
11371
:
Mark
getopt
error
messages
as
localizable
.
Patch
by
Filip
Gruszczy
ń
ski
.
Gruszczy
ń
ski
.
-
Issue
#
11333
:
Add
__slots__
to
collections
ABCs
.
-
Issue
#
11628
:
cmp_to_key
generated
class
should
use
__slots__
-
Issue
#
11628
:
cmp_to_key
generated
class
should
use
__slots__
-
Issue
#
5537
:
Fix
time2isoz
()
and
time2netscape
()
functions
of
-
Issue
#
5537
:
Fix
time2isoz
()
and
time2netscape
()
functions
of
...
...
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