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
11ca77e6
Kaydet (Commit)
11ca77e6
authored
Ara 17, 2005
tarafından
Neal Norwitz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Doc for PEP 341, needs improvement
üst
58f46b65
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
20 deletions
+22
-20
ref7.tex
Doc/ref/ref7.tex
+21
-19
NEWS
Misc/NEWS
+1
-1
No files found.
Doc/ref/ref7.tex
Dosyayı görüntüle @
11ca77e6
...
@@ -195,26 +195,25 @@ The \keyword{try} statement specifies exception handlers and/or cleanup
...
@@ -195,26 +195,25 @@ The \keyword{try} statement specifies exception handlers and/or cleanup
code for a group of statements:
code for a group of statements:
\begin{productionlist}
\begin{productionlist}
\production
{
try
_
stmt
}
\production
{
try
_
stmt
}
{
try1
_
stmt | try2
_
stmt
}
{
\token
{
try
_
exc
_
stmt
}
|
\token
{
try
_
fin
_
stmt
}}
\production
{
try1
_
stmt
}
\production
{
try
_
exc
_
stmt
}
{
"try" ":"
\token
{
suite
}}
{
"try" ":"
\token
{
suite
}}
\productioncont
{
("except" [
\token
{
expression
}
\productioncont
{
("except" [
\token
{
expression
}
[","
\token
{
target
}
]] ":"
\token
{
suite
}
)+
}
[","
\token
{
target
}
]] ":"
\token
{
suite
}
)+
}
\productioncont
{
["else" ":"
\token
{
suite
}
]
}
\productioncont
{
["else" ":"
\token
{
suite
}
]
}
\production
{
try
_
fin
_
stmt
}
\productioncont
{
["finally" ":"
\token
{
suite
}
]
}
{
"try" ":"
\token
{
suite
}
\production
{
try2
_
stmt
}
"finally" ":"
\token
{
suite
}}
{
"try" ":"
\token
{
suite
}}
\productioncont
{
"finally" ":"
\token
{
suite
}}
\end{productionlist}
\end{productionlist}
There are two forms of
\keyword
{
try
}
statement:
\versionchanged
[In previous versions of Python,
\keyword
{
try
}
...
\keyword
{
except
}
and
\keyword
{
try
}
...
\keyword
{
except
}
...
\keyword
{
finally
}
did not work.
\keyword
{
try
}
...
\keyword
{
finally
}
. These forms cannot be mixed (but
\keyword
{
try
}
...
\keyword
{
except
}
had to be nested in
they can be nested in each other).
\keyword
{
try
}
...
\keyword
{
finally
}
]
{
2.5
}
The
\keyword
{
try
}
...
\keyword
{
except
}
form specifies one or more
The
\keyword
{
except
}
clause(s) specify one or more exception handlers.
exception handlers
When no exception occurs in the
(the
\keyword
{
except
}
clauses). When no exception occurs in the
\keyword
{
try
}
clause, no exception handler is executed. When an
\keyword
{
try
}
clause, no exception handler is executed. When an
exception occurs in the
\keyword
{
try
}
suite, a search for an exception
exception occurs in the
\keyword
{
try
}
suite, a search for an exception
handler is started. This search inspects the except clauses in turn until
handler is started. This search inspects the except clauses in turn until
...
@@ -232,6 +231,8 @@ string object, not just a string with the same value).
...
@@ -232,6 +231,8 @@ string object, not just a string with the same value).
If no except clause matches the exception, the search for an exception
If no except clause matches the exception, the search for an exception
handler continues in the surrounding code and on the invocation stack.
handler continues in the surrounding code and on the invocation stack.
\footnote
{
The exception is propogated to the invocation stack only if
there is no
\keyword
{
finally
}
clause that negates the exception.
}
If the evaluation of an expression in the header of an except clause
If the evaluation of an expression in the header of an except clause
raises an exception, the original search for a handler is canceled
raises an exception, the original search for a handler is canceled
...
@@ -277,12 +278,13 @@ preceding \keyword{except} clauses.
...
@@ -277,12 +278,13 @@ preceding \keyword{except} clauses.
\stindex
{
break
}
\stindex
{
break
}
\stindex
{
continue
}
\stindex
{
continue
}
The
\keyword
{
try
}
...
\keyword
{
finally
}
form specifies a `cleanup' handler. The
If
\keyword
{
finally
}
is present, it specifies a `cleanup' handler. The
\keyword
{
try
}
clause is executed. When no exception occurs, the
\keyword
{
try
}
clause is executed, including any
\keyword
{
except
}
and
\keyword
{
finally
}
clause is executed. When an exception occurs in the
\keyword
{
else
}
clauses. If an exception occurs in any of the clauses
\keyword
{
try
}
clause, the exception is temporarily saved, the
and is not handled, the exception is temporarily saved. The
\keyword
{
finally
}
clause is executed, and then the saved exception is
\keyword
{
finally
}
clause is executed. If there is a saved exception,
re-raised. If the
\keyword
{
finally
}
clause raises another exception or
it is re-raised at the end of the
\keyword
{
finally
}
clause.
If the
\keyword
{
finally
}
clause raises another exception or
executes a
\keyword
{
return
}
or
\keyword
{
break
}
statement, the saved
executes a
\keyword
{
return
}
or
\keyword
{
break
}
statement, the saved
exception is lost. A
\keyword
{
continue
}
statement is illegal in the
exception is lost. A
\keyword
{
continue
}
statement is illegal in the
\keyword
{
finally
}
clause. (The reason is a problem with the current
\keyword
{
finally
}
clause. (The reason is a problem with the current
...
...
Misc/NEWS
Dosyayı görüntüle @
11ca77e6
...
@@ -14,7 +14,7 @@ Core and builtins
...
@@ -14,7 +14,7 @@ Core and builtins
- Implementation of PEP 341 - Unification of try/except and try/finally.
- Implementation of PEP 341 - Unification of try/except and try/finally.
"except" clauses can now be written together with a "finally" clause in
"except" clauses can now be written together with a "finally" clause in
one try statement instead of two nested ones.
one try statement instead of two nested ones.
Patch #1355913.
- Bug #1379994: Builtin unicode_escape and raw_unicode_escape codec
- Bug #1379994: Builtin unicode_escape and raw_unicode_escape codec
now encodes backslash correctly.
now encodes backslash correctly.
...
...
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