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
5bba6c27
Kaydet (Commit)
5bba6c27
authored
Nis 21, 2011
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge with 3.2.
üst
c6f079d1
0ee9c1be
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
argparse.rst
Doc/library/argparse.rst
+11
-11
No files found.
Doc/library/argparse.rst
Dosyayı görüntüle @
5bba6c27
...
...
@@ -997,7 +997,7 @@ etc. are all supported.
required
^^^^^^^^
In general, the
argparse
module assumes that flags like ``-f`` and ``--bar``
In general, the
:mod:`argparse`
module assumes that flags like ``-f`` and ``--bar``
indicate *optional* arguments, which can always be omitted at the command line.
To make an option *required*, ``True`` can be specified for the ``required=``
keyword argument to :meth:`add_argument`::
...
...
@@ -1617,9 +1617,9 @@ Mutual exclusion
.. method:: add_mutually_exclusive_group(required=False)
Create a mutually exclusive group.
argparse will make sure that only one of
the arguments in the mutually exclusive group was present on the command
line::
Create a mutually exclusive group.
:mod:`argparse` will make sure that only
one of the arguments in the mutually exclusive group was present on the
command
line::
>>> parser = argparse.ArgumentParser(prog='PROG')
>>> group = parser.add_mutually_exclusive_group()
...
...
@@ -1786,14 +1786,14 @@ Exiting methods
Upgrading optparse code
-----------------------
Originally, the
argparse module had attempted to maintain compatibility with
optparse. However, optparse was difficult to extend transparently, particularly
with the changes required to support the new ``nargs=`` specifiers and better
usage messages. When most everything in optparse had either been copy-pasted
over or monkey-patched, it no longer seemed practical to try to maintain the
backwards compatibility.
Originally, the
mod:`argparse` module had attempted to maintain compatibility
with :mod:`optparse`. However, :mod:`optparse` was difficult to extend
transparently, particularly with the changes required to support the new
``nargs=`` specifiers and better usage messages. When most everything in
:mod:`optparse` had either been copy-pasted over or monkey-patched, it no
longer seemed practical to try to maintain the
backwards compatibility.
A partial upgrade path from
optparse to argparse
:
A partial upgrade path from
:mod:`optparse` to :mod:`argparse`
:
* Replace all ``add_option()`` calls with :meth:`ArgumentParser.add_argument`
calls.
...
...
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