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
1aeeaeb7
Kaydet (Commit)
1aeeaeb7
authored
Mar 10, 2019
tarafından
Lysandros Nikolaou
Kaydeden (comit)
Nick Coghlan
Mar 10, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-21314: Add a FAQ entry about positional only parameters (GH-10641)
üst
11205b80
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
0 deletions
+47
-0
programming.rst
Doc/faq/programming.rst
+35
-0
functions.rst
Doc/library/functions.rst
+5
-0
inspect.rst
Doc/library/inspect.rst
+4
-0
2018-11-21-23-01-37.bpo-21314.PG33VT.rst
...xt/Documentation/2018-11-21-23-01-37.bpo-21314.PG33VT.rst
+3
-0
No files found.
Doc/faq/programming.rst
Dosyayı görüntüle @
1aeeaeb7
...
@@ -767,6 +767,41 @@ Yes. Usually this is done by nesting :keyword:`lambda` within
...
@@ -767,6 +767,41 @@ Yes. Usually this is done by nesting :keyword:`lambda` within
Don't try this at home, kids!
Don't try this at home, kids!
.. _faq-positional-only-arguments:
What does the slash(/) in the parameter list of a function mean?
----------------------------------------------------------------
A slash in the argument list of a function denotes that the parameters prior to
it are positional-only. Positional-only parameters are the ones without an
externally-usable name. Upon calling a function that accepts positional-only
parameters, arguments are mapped to parameters based solely on their position.
For example, :func:`pow` is a function that accepts positional-only parameters.
Its documentation looks like this::
>>> help(pow)
Help on built-in function pow in module builtins:
pow(x, y, z=None, /)
Equivalent to x**y (with two arguments) or x**y % z (with three arguments)
Some types, such as ints, are able to use a more efficient algorithm when
invoked using the three argument form.
The slash at the end of the parameter list means that all three parameters are
positional-only. Thus, calling :func:`pow` with keyword aguments would lead to
an error::
>>> pow(x=3, y=4)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: pow() takes no keyword arguments
Note that as of this writing this is only documentational and no valid syntax
in Python, although there is :pep:`570`, which proposes a syntax for
position-only parameters in Python.
Numbers and strings
Numbers and strings
===================
===================
...
...
Doc/library/functions.rst
Dosyayı görüntüle @
1aeeaeb7
...
@@ -669,6 +669,11 @@ are always available. They are listed here in alphabetical order.
...
@@ -669,6 +669,11 @@ are always available. They are listed here in alphabetical order.
topic, and a help page is printed on the console. If the argument is any other
topic, and a help page is printed on the console. If the argument is any other
kind of object, a help page on the object is generated.
kind of object, a help page on the object is generated.
Note that if a slash(/) appears in the parameter list of a function, when
invoking :func:`help`, it means that the parameters prior to the slash are
positional-only. For more info, see
:ref:`the FAQ entry on positional-only parameters <faq-positional-only-arguments>`.
This function is added to the built-in namespace by the :mod:`site` module.
This function is added to the built-in namespace by the :mod:`site` module.
.. versionchanged:: 3.4
.. versionchanged:: 3.4
...
...
Doc/library/inspect.rst
Dosyayı görüntüle @
1aeeaeb7
...
@@ -572,6 +572,10 @@ function.
...
@@ -572,6 +572,10 @@ function.
Raises :exc:`ValueError` if no signature can be provided, and
Raises :exc:`ValueError` if no signature can be provided, and
:exc:`TypeError` if that type of object is not supported.
:exc:`TypeError` if that type of object is not supported.
A slash(/) in the signature of a function denotes that the parameters prior
to it are positional-only. For more info, see
:ref:`the FAQ entry on positional-only parameters <faq-positional-only-arguments>`.
.. versionadded:: 3.5
.. versionadded:: 3.5
``follow_wrapped`` parameter. Pass ``False`` to get a signature of
``follow_wrapped`` parameter. Pass ``False`` to get a signature of
``callable`` specifically (``callable.__wrapped__`` will not be used to
``callable`` specifically (``callable.__wrapped__`` will not be used to
...
...
Misc/NEWS.d/next/Documentation/2018-11-21-23-01-37.bpo-21314.PG33VT.rst
0 → 100644
Dosyayı görüntüle @
1aeeaeb7
A new entry was added to the Core Language Section of the Programming FAQ,
which explaines the usage of slash(/) in the signature of a function. Patch
by Lysandros Nikolaou
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