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
e4c96ad7
Kaydet (Commit)
e4c96ad7
authored
Şub 06, 2008
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Update docs for collections ABCs and for collections.UserDict.
üst
0fc8351f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
60 deletions
+41
-60
collections.rst
Doc/library/collections.rst
+41
-7
userdict.rst
Doc/library/userdict.rst
+0
-52
NEWS
Misc/NEWS
+0
-1
No files found.
Doc/library/collections.rst
Dosyayı görüntüle @
e4c96ad7
...
...
@@ -32,25 +32,32 @@ ABC Notes
:class:`collections.Iterable` Defines ``__iter__()``
:class:`collections.Iterator` Derived from :class:`Iterable` and in
addition defines ``__next__()``
:class:`collections.Sized` Defines ``__len__()``
:class:`collections.Mapping` Derived from :class:`Container`,
:class:`Iterable`,
and :class:`Sized`, and in addition
defines ``__getitem__()``, ``get()``,
``__contains__()``, ``__len__()``,
``__eq__()``, ``__ne__()``,
``__iter__()``, ``keys()``,
``items()``, and ``values()``
:class:`collections.MutableMapping` Derived from :class:`Mapping`
:class:`collections.Sequence` Derived from :class:`Container`,
:class:`Iterable`, and :class:`Sized`,
and in addition defines
``__getitem__()`
:class:`collections.MutableSequence` Derived from :class:`Sequence`
:class:`collections.Set` Derived from :class:`Container`, :class:`Iterable`, :class:`Sized`.
add in addition defines
``__le__()``, ``__lt__()``, ``__eq__()``,
``__and__()``, ``__or__()``, ``__sub__()``,
``__xor__()``, and ``isdisjoint()``,
:class:`collections.MutableSet` Derived from :class:`Set` and in
addition defines ``add()``,
``clear()``, ``discard()``, ``pop()``,
and ``toggle()``
:class:`collections.Sequence` Derived from :class:`Container`,
:class:`Iterable`, and :class:`Sized`,
and in addition defines
``__getitem__()``
:class:`collections.Set` Derived from :class:`Container`, :class:`Iterable`, and :class:`Sized`
:class:`collections.Sized` Defines ``__len__()``
``remove()``, ``__ior__()``, ``__iand__()``,
``__ixor__()``, and ``__isub__()``
===================================== ========================================
.. XXX Have not included them all and the notes are incomplete
...
...
@@ -577,3 +584,30 @@ customize a prototype instance::
.. [#] For information on the double-star-operator see
:ref:`tut-unpacking-arguments` and :ref:`calls`.
:class:`UserDict` objects
----------------------
The class, :class:`UserDict` acts as a wrapper around dictionary objects.
The need for this class has been partially supplanted by the ability to
subclass directly from :class:`dict`; however, this class can be easier
to work with because the underlying dictionary is accessible as an
attribute.
.. class:: UserDict([initialdata])
Class that simulates a dictionary. The instance's contents are kept in a
regular dictionary, which is accessible via the :attr:`data` attribute of
:class:`UserDict` instances. If *initialdata* is provided, :attr:`data` is
initialized with its contents; note that a reference to *initialdata* will not
be kept, allowing it be used for other purposes.
In addition to supporting the methods and operations of mappings,
:class:`UserDict` and :class:`IterableUserDict` instances
provide the following attribute:
.. attribute:: UserDict.data
A real dictionary used to store the contents of the :class:`UserDict` class.
Doc/library/userdict.rst
Dosyayı görüntüle @
e4c96ad7
:mod:`UserDict` --- Class wrapper for dictionary objects
========================================================
.. module:: UserDict
:synopsis: Class wrapper for dictionary objects.
The module defines a mixin, :class:`DictMixin`, defining all dictionary methods
for classes that already have a minimum mapping interface. This greatly
simplifies writing classes that need to be substitutable for dictionaries (such
as the shelve module).
This also module defines a class, :class:`UserDict`, that acts as a wrapper
around dictionary objects. The need for this class has been largely supplanted
by the ability to subclass directly from :class:`dict` (a feature that became
available starting with Python version 2.2). Prior to the introduction of
:class:`dict`, the :class:`UserDict` class was used to create dictionary-like
sub-classes that obtained new behaviors by overriding existing methods or adding
new ones.
The :mod:`UserDict` module defines the :class:`UserDict` class and
:class:`DictMixin`:
.. class:: UserDict([initialdata])
Class that simulates a dictionary. The instance's contents are kept in a
regular dictionary, which is accessible via the :attr:`data` attribute of
:class:`UserDict` instances. If *initialdata* is provided, :attr:`data` is
initialized with its contents; note that a reference to *initialdata* will not
be kept, allowing it be used for other purposes.
.. note::
For backward compatibility, instances of :class:`UserDict` are not
iterable.
.. class:: IterableUserDict([initialdata])
Subclass of :class:`UserDict` that supports direct iteration (e.g. ``for key in
myDict``).
In addition to supporting the methods and operations of mappings (see section
:ref:`typesmapping`), :class:`UserDict` and :class:`IterableUserDict` instances
provide the following attribute:
.. attribute:: IterableUserDict.data
A real dictionary used to store the contents of the :class:`UserDict` class.
:mod:`UserList` --- Class wrapper for list objects
==================================================
...
...
Misc/NEWS
Dosyayı görüntüle @
e4c96ad7
...
...
@@ -75,7 +75,6 @@ Library
- Created new UserDict class in collections module. This one inherits from and
complies with the MutableMapping ABC.
XXX still need to move docs
- Removed UserDict.DictMixin. Replaced all its uses with collections.MutableMapping.
...
...
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