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
b4534ae7
Kaydet (Commit)
b4534ae7
authored
Eki 13, 2013
tarafından
Nick Coghlan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Docs tweaks for contextlib additions
üst
ed7bb488
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
contextlib.rst
Doc/library/contextlib.rst
+12
-2
3.4.rst
Doc/whatsnew/3.4.rst
+13
-0
No files found.
Doc/library/contextlib.rst
Dosyayı görüntüle @
b4534ae7
...
...
@@ -99,22 +99,27 @@ Functions and classes provided:
Return a context manager that ignores the specified exceptions if they
occur in the body of a with-statement.
As with any other mechanism that completely suppresses exceptions, it
should only be used to cover very specific errors where silently
ignoring the exception is known to be the right thing to do.
For example::
from contextlib import ignore
with ignore(
OS
Error):
with ignore(
FileNotFound
Error):
os.remove('somefile.tmp')
This code is equivalent to::
try:
os.remove('somefile.tmp')
except
OS
Error:
except
FileNotFound
Error:
pass
.. versionadded:: 3.4
.. function:: redirect_stdout(new_target)
Context manager for temporarily redirecting :data:`sys.stdout` to
...
...
@@ -144,6 +149,11 @@ Functions and classes provided:
with redirect_stdout(sys.stderr):
help(pow)
Note that the global side effect on :data:`sys.stdout` means that this
context manager is not suitable for use in library code and most threaded
applications. It also has no effect on the output of subprocesses.
However, it is still a useful approach for many utility scripts.
.. versionadded:: 3.4
.. class:: ContextDecorator()
...
...
Doc/whatsnew/3.4.rst
Dosyayı görüntüle @
b4534ae7
...
...
@@ -205,6 +205,19 @@ been expanded so that they match the FCC NTSC versions. The change in
results should be less than 1% and may better match results found elsewhere.
contextlib
----------
The new :class:`contextlib.ignore` context manager helps to clarify the
intent of code that deliberately ignores failures from a particular
operation.
The new :class:`contextlib.redirect_stdio` context manager makes it easier
for utility scripts to handle inflexible APIs that don't provide any
options to retrieve their output as a string or direct it to somewhere
other than :data:`sys.stdout`.
dis
---
...
...
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