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
4a1b62a5
Kaydet (Commit)
4a1b62a5
authored
Şub 03, 2009
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Record operator deprecations in docs.
üst
d6fc2623
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
23 deletions
+19
-23
operator.rst
Doc/library/operator.rst
+19
-23
No files found.
Doc/library/operator.rst
Dosyayı görüntüle @
4a1b62a5
...
...
@@ -269,6 +269,9 @@ Operations which work with sequences include:
.. function:: repeat(a, b)
__repeat__(a, b)
.. deprecated:: 2.7
Use :func:`__mul__` instead.
Return ``a * b`` where *a* is a sequence and *b* is an integer.
...
...
@@ -387,6 +390,9 @@ example, the :term:`statement` ``x += y`` is equivalent to
.. function:: irepeat(a, b)
__irepeat__(a, b)
.. deprecated:: 2.7
Use :func:`__imul__` instead.
``a = irepeat(a, b)`` is equivalent to ``a *= b`` where *a* is a sequence and
*b* is an integer.
...
...
@@ -427,33 +433,14 @@ example, the :term:`statement` ``x += y`` is equivalent to
The :mod:`operator` module also defines a few predicates to test the type of
objects.
.. note::
Be careful not to misinterpret the results of these functions; only
:func:`isCallable` has any measure of reliability with instance objects.
For example:
>>> class C:
... pass
...
>>> import operator
>>> obj = C()
>>> operator.isMappingType(obj)
True
.. note::
Python 3 is expected to introduce abstract base classes for
collection types, so it should be possible to write, for example,
``isinstance(obj, collections.Mapping)`` and ``isinstance(obj,
collections.Sequence)``.
objects; however, these are not all reliable. It is preferable to test
abstract base classes instead (see :mod:`collections` and
:mod:`numbers` for details).
.. function:: isCallable(obj)
.. deprecated:: 2.0
Use
the :func:`callable` built-in function
instead.
Use
``isinstance(x, collections.Callable)``
instead.
Returns true if the object *obj* can be called like a function, otherwise it
returns false. True is returned for functions, bound and unbound methods, class
...
...
@@ -462,6 +449,9 @@ objects.
.. function:: isMappingType(obj)
.. deprecated:: 2.7
Use ``isinstance(x, collections.Mapping)`` instead.
Returns true if the object *obj* supports the mapping interface. This is true for
dictionaries and all instance objects defining :meth:`__getitem__`.
...
...
@@ -474,6 +464,9 @@ objects.
.. function:: isNumberType(obj)
.. deprecated:: 2.7
Use ``isinstance(x, numbers.Number)`` instead.
Returns true if the object *obj* represents a number. This is true for all
numeric types implemented in C.
...
...
@@ -486,6 +479,9 @@ objects.
.. function:: isSequenceType(obj)
.. deprecated:: 2.7
Use ``isinstance(x, collections.Sequence)`` instead.
Returns true if the object *obj* supports the sequence protocol. This returns true
for all objects which define sequence methods in C, and for all instance objects
defining :meth:`__getitem__`.
...
...
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