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
2e0b7557
Kaydet (Commit)
2e0b7557
authored
Kas 27, 2007
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Futher update docs after unbound method removal.
üst
ff737954
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
27 additions
and
28 deletions
+27
-28
concrete.rst
Doc/c-api/concrete.rst
+2
-1
apiref.rst
Doc/distutils/apiref.rst
+3
-3
new.rst
Doc/library/new.rst
+2
-0
operator.rst
Doc/library/operator.rst
+1
-1
stdtypes.rst
Doc/library/stdtypes.rst
+13
-17
weakref.rst
Doc/library/weakref.rst
+4
-4
datamodel.rst
Doc/reference/datamodel.rst
+0
-0
bgenObjectDefinition.py
Tools/bgen/bgen/bgenObjectDefinition.py
+2
-2
No files found.
Doc/c-api/concrete.rst
Dosyayı görüntüle @
2e0b7557
...
...
@@ -2600,8 +2600,9 @@ There are some useful functions that are useful for working with method objects.
function that will be called when the method is called. If this method should
be bound to an instance, *self* should be the instance and *class* should be the
class of *self*, otherwise *self* should be *NULL* and *class* should be the
class which provides the unbound method.
.
class which provides the unbound method.
.. XXX no unbound methods anymore...
.. cfunction:: PyObject* PyMethod_Class(PyObject *meth)
...
...
Doc/distutils/apiref.rst
Dosyayı görüntüle @
2e0b7557
...
...
@@ -1965,12 +1965,12 @@ Subclasses of :class:`Command` must define the following methods.
as the parent with sub-commands ``install_lib``, ``install_headers``, etc. The
parent of a family of commands defines *sub_commands* as a class attribute; it's
a list of 2-tuples ``(command_name, predicate)``, with *command_name* a string
and *predicate* a
n unbound method
, a string or None. *predicate* is a method of
and *predicate* a
function
, a string or None. *predicate* is a method of
the parent command that determines whether the corresponding command is
applicable in the current situation. (Eg. we ``install_headers`` is only
applicable if we have any C header files to install.) If *predicate* is None,
that command is always applicable.
*sub_commands* is usually defined at the \*end\* of a class, because predicates
can be
unbound methods, so they must already have been defined. The canonical
example is the :command:`install` command.
can be
methods of the class, so they must already have been defined. The
canonical
example is the :command:`install` command.
Doc/library/new.rst
Dosyayı görüntüle @
2e0b7557
...
...
@@ -22,6 +22,8 @@ The :mod:`new` module defines the following functions:
This function will return a method object, bound to *instance*.
*function* must be callable.
.. XXX no unbound methods anymore
.. function:: function(code, globals[, name[, argdefs[, closure]]])
...
...
Doc/library/operator.rst
Dosyayı görüntüle @
2e0b7557
...
...
@@ -390,7 +390,7 @@ objects.
Use the :func:`callable` built-in function 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
returns false. True is returned for functions,
instance
methods, class
objects, and instance objects which support the :meth:`__call__` method.
...
...
Doc/library/stdtypes.rst
Dosyayı görüntüle @
2e0b7557
...
...
@@ -2215,23 +2215,19 @@ two flavors: built-in methods (such as :meth:`append` on lists) and class
instance methods. Built-in methods are described with the types that support
them.
The implementation adds two special read-only attributes to class instance
methods: ``m.__self__`` is the object on which the method operates, and
``m.__func__`` is the function implementing the method. Calling ``m(arg-1,
arg-2, ..., arg-n)`` is completely equivalent to calling ``m.__func__(
m.__self__, arg-1, arg-2, ..., arg-n)``.
Class instance methods are either *bound* or *unbound*, referring to whether the
method was accessed through an instance or a class, respectively. When a method
is unbound, its ``__self__`` attribute will be ``None`` and if called, an
explicit ``self`` object must be passed as the first argument. In this case,
``self`` must be an instance of the unbound method's class (or a subclass of
that class), otherwise a :exc:`TypeError` is raised.
Like function objects, methods objects support getting arbitrary attributes.
However, since method attributes are actually stored on the underlying function
object (``meth.__func__``), setting method attributes on either bound or unbound
methods is disallowed. Attempting to set a method attribute results in a
If you access a method (a function defined in a class namespace) through an
instance, you get a special object: a :dfn:`bound method` (also called
:dfn:`instance method`) object. When called, it will add the ``self`` argument
to the argument list. Bound methods have two special read-only attributes:
``m.__self__`` is the object on which the method operates, and ``m.__func__`` is
the function implementing the method. Calling ``m(arg-1, arg-2, ..., arg-n)``
is completely equivalent to calling ``m.__func__(m.__self__, arg-1, arg-2, ...,
arg-n)``.
Like function objects, bound method objects support getting arbitrary
attributes. However, since method attributes are actually stored on the
underlying function object (``meth.__func__``), setting method attributes on
bound methods is disallowed. Attempting to set a method attribute results in a
:exc:`TypeError` being raised. In order to set a method attribute, you need to
explicitly set it on the underlying function object::
...
...
Doc/library/weakref.rst
Dosyayı görüntüle @
2e0b7557
...
...
@@ -50,10 +50,10 @@ directly. The low-level machinery used by the weak dictionary implementations
is exposed by the :mod:`weakref` module for the benefit of advanced uses.
Not all objects can be weakly referenced; those objects which can include class
instances, functions written in Python (but not in C),
methods (both bound and
unbound), sets, frozensets, file objects, :term:`generator`\s, type objects,
:class:`DBcursor` objects from the :mod:`bsddb` module, sockets, arrays, deques,
and regular
expression pattern objects.
instances, functions written in Python (but not in C),
instance methods, sets,
frozensets, file objects, :term:`generator`\s, type objects, :class:`DBcursor`
objects from the :mod:`bsddb` module, sockets, arrays, deques, and regular
expression pattern objects.
Several builtin types such as :class:`list` and :class:`dict` do not directly
support weak references but can add support through subclassing::
...
...
Doc/reference/datamodel.rst
Dosyayı görüntüle @
2e0b7557
This diff is collapsed.
Click to expand it.
Tools/bgen/bgen/bgenObjectDefinition.py
Dosyayı görüntüle @
2e0b7557
...
...
@@ -236,8 +236,8 @@ class PEP252Mixin:
def
assertions
(
self
):
# Check that various things aren't overridden. If they are it could
# signify a bgen-client that has been partially converted to PEP252.
assert
self
.
outputGetattr
.
im_func
==
PEP252Mixin
.
outputGetattr
.
im_func
assert
self
.
outputSetattr
.
im_func
==
PEP252Mixin
.
outputSetattr
.
im_func
assert
self
.
outputGetattr
.
__func__
==
PEP252Mixin
.
outputGetattr
.
__func__
assert
self
.
outputSetattr
.
__func__
==
PEP252Mixin
.
outputSetattr
.
__func__
assert
self
.
outputGetattrBody
==
None
assert
self
.
outputGetattrHook
==
None
assert
self
.
basechain
==
"NULL"
...
...
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