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
ac191ce1
Kaydet (Commit)
ac191ce1
authored
Agu 10, 2014
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #22174: Clean-up grammar and ambiguities in property() docs.
üst
31b3683d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
functions.rst
Doc/library/functions.rst
+13
-7
ACKS
Misc/ACKS
+1
-0
No files found.
Doc/library/functions.rst
Dosyayı görüntüle @
ac191ce1
...
...
@@ -1106,9 +1106,11 @@ are always available. They are listed here in alphabetical order.
Return a property attribute.
*fget* is a function for getting an attribute value, likewise *fset* is a
function for setting, and *fdel* a function for del'ing, an attribute. Typical
use is to define a managed attribute ``x``::
*fget* is a function for getting an attribute value. *fset* is a function
for setting an attribute value. *fdel* is a function for deleting an attribute
value. And *doc* creates a docstring for the attribute.
A typical use is to define a managed attribute ``x``::
class C:
def __init__(self):
...
...
@@ -1116,13 +1118,16 @@ are always available. They are listed here in alphabetical order.
def getx(self):
return self._x
def setx(self, value):
self._x = value
def delx(self):
del self._x
x = property(getx, setx, delx, "I'm the 'x' property.")
If
then
*c* is an instance of *C*, ``c.x`` will invoke the getter,
If *c* is an instance of *C*, ``c.x`` will invoke the getter,
``c.x = value`` will invoke the setter and ``del c.x`` the deleter.
If given, *doc* will be the docstring of the property attribute. Otherwise, the
...
...
@@ -1138,8 +1143,9 @@ are always available. They are listed here in alphabetical order.
"""Get the current voltage."""
return self._voltage
turns the :meth:`voltage` method into a "getter" for a read-only attribute
with the same name.
The ``@property`` decorator turns the :meth:`voltage` method into a "getter"
for a read-only attribute with the same name, and it sets the docstring for
*voltage* to "Get the current voltage."
A property object has :attr:`~property.getter`, :attr:`~property.setter`,
and :attr:`~property.deleter` methods usable as decorators that create a
...
...
@@ -1167,7 +1173,7 @@ are always available. They are listed here in alphabetical order.
additional functions the same name as the original property (``x`` in this
case.)
The returned property also has the attributes ``fget``, ``fset``, and
The returned property
object
also has the attributes ``fget``, ``fset``, and
``fdel`` corresponding to the constructor arguments.
...
...
Misc/ACKS
Dosyayı görüntüle @
ac191ce1
...
...
@@ -248,6 +248,7 @@ David Cinege
Craig Citro
Gilles Civario
Chris Clark
Diana Clarke
Laurie Clark-Michalek
Mike Clarkson
Andrew Clegg
...
...
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