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
7268e9d1
Kaydet (Commit)
7268e9d1
authored
Eyl 20, 2007
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fit nits
üst
8c202440
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
collections.rst
Doc/library/collections.rst
+11
-7
No files found.
Doc/library/collections.rst
Dosyayı görüntüle @
7268e9d1
...
...
@@ -360,8 +360,8 @@ Setting the :attr:`default_factory` to :class:`set` makes the
.. _named-tuple-factory:
:func:`NamedTuple`
factory function
-----------------------------------
:func:`NamedTuple`
Factory Function for Tuples with Named Fields
-----------------------------------
-----------------------------
Named tuples assign meaning to each position in a tuple and allow for more readable,
self-documenting code. They can be used wherever regular tuples are used, and
...
...
@@ -376,12 +376,12 @@ they add the ability to access fields by name instead of position index.
method which lists the tuple contents in a ``name=value`` format.
The *fieldnames* are specified in a single string with each fieldname separated by
a space and/or comma. Any valid Python identifier may be used for a field
name.
a space and/or comma. Any valid Python identifier may be used for a fieldname.
If *verbose* is true,
the *NamedTuple* call
will print the class definition.
If *verbose* is true, will print the class definition.
*NamedTuple* instances do not have per-instance dictionaries, so they are
lightweight
, requiring
no more memory than regular tuples.
lightweight
and require
no more memory than regular tuples.
.. versionadded:: 2.6
...
...
@@ -434,7 +434,9 @@ an additonal method and an informational read-only attribute.
.. method:: somenamedtuple.replace(field, value)
Return a new instance of the named tuple replacing the named *field* with a new *value*::
Return a new instance of the named tuple replacing the named *field* with a new *value*:
::
>>> p = Point(x=11, y=22)
>>> p.__replace__('x', 33)
...
...
@@ -447,7 +449,9 @@ an additonal method and an informational read-only attribute.
Return a tuple of strings listing the field names. This is useful for introspection,
for converting a named tuple instance to a dictionary, and for combining named tuple
types to create new named tuple types::
types to create new named tuple types:
::
>>> p.__fields__ # view the field names
('x', 'y')
...
...
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