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
611be707
Kaydet (Commit)
611be707
authored
Tem 07, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
replace vars() with locals() and globals(); 3rd raise arg; typos
üst
8fd02194
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
38 deletions
+56
-38
ref4.tex
Doc/ref/ref4.tex
+6
-5
ref6.tex
Doc/ref/ref6.tex
+22
-14
ref4.tex
Doc/ref4.tex
+6
-5
ref6.tex
Doc/ref6.tex
+22
-14
No files found.
Doc/ref/ref4.tex
Dosyayı görüntüle @
611be707
...
@@ -125,13 +125,14 @@ overridden with optional extra arguments.
...
@@ -125,13 +125,14 @@ overridden with optional extra arguments.
\end{description}
\end{description}
The built-in function
\verb
@
vars()
@
returns a dictionary representing
The built-in functions
\verb
@
globals()
@
and
\verb
@
locals()
@
returns a
the current local name space. The effect of modifications to this
dictionary representing the current global and local name space,
dictionary on the name space are undefined.
%
respectively. The effect of modifications to this dictionary on the
\footnote
{
The current implementation returns the dictionary actually
name space are undefined.
%
\footnote
{
The current implementations return the dictionary actually
used to implement the name space,
{
\em
except
}
for functions, where
used to implement the name space,
{
\em
except
}
for functions, where
the optimizer may cause the local name space to be implemented
the optimizer may cause the local name space to be implemented
differently.
}
differently
, and
\verb
@
locals()
@
returns a read-only dictionary
.
}
\section
{
Exceptions
}
\section
{
Exceptions
}
...
...
Doc/ref/ref6.tex
Dosyayı görüntüle @
611be707
...
@@ -30,24 +30,24 @@ returns no meaningful result; in Python, procedures return the value
...
@@ -30,24 +30,24 @@ returns no meaningful result; in Python, procedures return the value
\verb
@
None
@
):
\verb
@
None
@
):
\begin{verbatim}
\begin{verbatim}
expression
_
stmt:
express
ion
_
list
expression
_
stmt:
condit
ion
_
list
\end{verbatim}
\end{verbatim}
An expression statement evaluates the expression list (which may be a
An expression statement evaluates the condition list (which may be a
single expression). If the value is not
\verb
@
None
@
, it is converted
single condition).
\indexii
{
expression
}{
list
}
In interactive mode, if the value is not
\verb
@
None
@
, it is converted
to a string using the rules for string conversions (expressions in
to a string using the rules for string conversions (expressions in
reverse quotes), and the resulting string is written to standard
reverse quotes), and the resulting string is written to standard
output (see section
\ref
{
print
}
) on a line by itself.
output (see section
\ref
{
print
}
) on a line by itself.
\indexii
{
expression
}{
list
}
(The exception for
\verb
@
None
@
is made so that procedure calls, which
are syntactically equivalent to expressions, do not cause any output.)
\ttindex
{
None
}
\ttindex
{
None
}
\indexii
{
string
}{
conversion
}
\indexii
{
string
}{
conversion
}
\index
{
output
}
\index
{
output
}
\indexii
{
standard
}{
output
}
\indexii
{
standard
}{
output
}
\indexii
{
writing
}{
values
}
\indexii
{
writing
}{
values
}
(The exception for
\verb
@
None
@
is made so that procedure calls, which
are syntactically equivalent to expressions, do not cause any output.
A tuple with only
\verb
@
None
@
items is written normally.)
\indexii
{
procedure
}{
call
}
\indexii
{
procedure
}{
call
}
\section
{
Assignment statements
}
\section
{
Assignment statements
}
...
@@ -224,7 +224,7 @@ required syntactically, but no code needs to be executed, for example:
...
@@ -224,7 +224,7 @@ required syntactically, but no code needs to be executed, for example:
\begin{verbatim}
\begin{verbatim}
def f(arg): pass # a function that does nothing (yet)
def f(arg): pass # a function that does nothing (yet)
class C: pass # a
n
class with no methods (yet)
class C: pass # a class with no methods (yet)
\end{verbatim}
\end{verbatim}
\section
{
The
{
\tt
del
}
statement
}
\section
{
The
{
\tt
del
}
statement
}
...
@@ -320,7 +320,7 @@ before really leaving the function.
...
@@ -320,7 +320,7 @@ before really leaving the function.
\stindex
{
raise
}
\stindex
{
raise
}
\begin{verbatim}
\begin{verbatim}
raise
_
stmt: "raise" condition ["," condition]
raise
_
stmt: "raise" condition ["," condition
["," condition]
]
\end{verbatim}
\end{verbatim}
\verb
@
raise
@
evaluates its first condition, which must yield
\verb
@
raise
@
evaluates its first condition, which must yield
...
@@ -337,7 +337,15 @@ If the first object is a class or string, it then raises the exception
...
@@ -337,7 +337,15 @@ If the first object is a class or string, it then raises the exception
identified by the first object, with the second one (or
\verb
@
None
@
)
identified by the first object, with the second one (or
\verb
@
None
@
)
as its parameter. If the first object is an instance, it raises the
as its parameter. If the first object is an instance, it raises the
exception identified by the class of the object, with the instance as
exception identified by the class of the object, with the instance as
its parameter.
its parameter (and there should be no second object, or the second
object should be
\verb
@
None
@
).
If a third object is present, and it it not
\verb
@
None
@
, it should be
a traceback object (see section
\ref
{
traceback
}
), and it is
substituted instead of the current location as the place where the
exception occurred. This is useful to re-raise an exception
transparently in an except clause.
\obindex
{
traceback
}
\section
{
The
{
\tt
break
}
statement
}
\section
{
The
{
\tt
break
}
statement
}
\stindex
{
break
}
\stindex
{
break
}
...
@@ -525,6 +533,6 @@ must be dictionaries and they are used for the global and local
...
@@ -525,6 +533,6 @@ must be dictionaries and they are used for the global and local
variables, respectively.
variables, respectively.
Hints: dynamic evaluation of expressions is supported by the built-in
Hints: dynamic evaluation of expressions is supported by the built-in
function
\verb
@
eval()
@
. The built-in function
\verb
@
vars()
@
returns
function
\verb
@
eval()
@
. The built-in function
s
\verb
@
globals()
@
and
the current local dictionary, which may be useful to pass around for
\verb
@
locals()
@
return the current global and local dictionary,
use by
\verb
@
exec
@
.
respectively, which may be useful to pass around for
use by
\verb
@
exec
@
.
Doc/ref4.tex
Dosyayı görüntüle @
611be707
...
@@ -125,13 +125,14 @@ overridden with optional extra arguments.
...
@@ -125,13 +125,14 @@ overridden with optional extra arguments.
\end{description}
\end{description}
The built-in function
\verb
@
vars()
@
returns a dictionary representing
The built-in functions
\verb
@
globals()
@
and
\verb
@
locals()
@
returns a
the current local name space. The effect of modifications to this
dictionary representing the current global and local name space,
dictionary on the name space are undefined.
%
respectively. The effect of modifications to this dictionary on the
\footnote
{
The current implementation returns the dictionary actually
name space are undefined.
%
\footnote
{
The current implementations return the dictionary actually
used to implement the name space,
{
\em
except
}
for functions, where
used to implement the name space,
{
\em
except
}
for functions, where
the optimizer may cause the local name space to be implemented
the optimizer may cause the local name space to be implemented
differently.
}
differently
, and
\verb
@
locals()
@
returns a read-only dictionary
.
}
\section
{
Exceptions
}
\section
{
Exceptions
}
...
...
Doc/ref6.tex
Dosyayı görüntüle @
611be707
...
@@ -30,24 +30,24 @@ returns no meaningful result; in Python, procedures return the value
...
@@ -30,24 +30,24 @@ returns no meaningful result; in Python, procedures return the value
\verb
@
None
@
):
\verb
@
None
@
):
\begin{verbatim}
\begin{verbatim}
expression
_
stmt:
express
ion
_
list
expression
_
stmt:
condit
ion
_
list
\end{verbatim}
\end{verbatim}
An expression statement evaluates the expression list (which may be a
An expression statement evaluates the condition list (which may be a
single expression). If the value is not
\verb
@
None
@
, it is converted
single condition).
\indexii
{
expression
}{
list
}
In interactive mode, if the value is not
\verb
@
None
@
, it is converted
to a string using the rules for string conversions (expressions in
to a string using the rules for string conversions (expressions in
reverse quotes), and the resulting string is written to standard
reverse quotes), and the resulting string is written to standard
output (see section
\ref
{
print
}
) on a line by itself.
output (see section
\ref
{
print
}
) on a line by itself.
\indexii
{
expression
}{
list
}
(The exception for
\verb
@
None
@
is made so that procedure calls, which
are syntactically equivalent to expressions, do not cause any output.)
\ttindex
{
None
}
\ttindex
{
None
}
\indexii
{
string
}{
conversion
}
\indexii
{
string
}{
conversion
}
\index
{
output
}
\index
{
output
}
\indexii
{
standard
}{
output
}
\indexii
{
standard
}{
output
}
\indexii
{
writing
}{
values
}
\indexii
{
writing
}{
values
}
(The exception for
\verb
@
None
@
is made so that procedure calls, which
are syntactically equivalent to expressions, do not cause any output.
A tuple with only
\verb
@
None
@
items is written normally.)
\indexii
{
procedure
}{
call
}
\indexii
{
procedure
}{
call
}
\section
{
Assignment statements
}
\section
{
Assignment statements
}
...
@@ -224,7 +224,7 @@ required syntactically, but no code needs to be executed, for example:
...
@@ -224,7 +224,7 @@ required syntactically, but no code needs to be executed, for example:
\begin{verbatim}
\begin{verbatim}
def f(arg): pass # a function that does nothing (yet)
def f(arg): pass # a function that does nothing (yet)
class C: pass # a
n
class with no methods (yet)
class C: pass # a class with no methods (yet)
\end{verbatim}
\end{verbatim}
\section
{
The
{
\tt
del
}
statement
}
\section
{
The
{
\tt
del
}
statement
}
...
@@ -320,7 +320,7 @@ before really leaving the function.
...
@@ -320,7 +320,7 @@ before really leaving the function.
\stindex
{
raise
}
\stindex
{
raise
}
\begin{verbatim}
\begin{verbatim}
raise
_
stmt: "raise" condition ["," condition]
raise
_
stmt: "raise" condition ["," condition
["," condition]
]
\end{verbatim}
\end{verbatim}
\verb
@
raise
@
evaluates its first condition, which must yield
\verb
@
raise
@
evaluates its first condition, which must yield
...
@@ -337,7 +337,15 @@ If the first object is a class or string, it then raises the exception
...
@@ -337,7 +337,15 @@ If the first object is a class or string, it then raises the exception
identified by the first object, with the second one (or
\verb
@
None
@
)
identified by the first object, with the second one (or
\verb
@
None
@
)
as its parameter. If the first object is an instance, it raises the
as its parameter. If the first object is an instance, it raises the
exception identified by the class of the object, with the instance as
exception identified by the class of the object, with the instance as
its parameter.
its parameter (and there should be no second object, or the second
object should be
\verb
@
None
@
).
If a third object is present, and it it not
\verb
@
None
@
, it should be
a traceback object (see section
\ref
{
traceback
}
), and it is
substituted instead of the current location as the place where the
exception occurred. This is useful to re-raise an exception
transparently in an except clause.
\obindex
{
traceback
}
\section
{
The
{
\tt
break
}
statement
}
\section
{
The
{
\tt
break
}
statement
}
\stindex
{
break
}
\stindex
{
break
}
...
@@ -525,6 +533,6 @@ must be dictionaries and they are used for the global and local
...
@@ -525,6 +533,6 @@ must be dictionaries and they are used for the global and local
variables, respectively.
variables, respectively.
Hints: dynamic evaluation of expressions is supported by the built-in
Hints: dynamic evaluation of expressions is supported by the built-in
function
\verb
@
eval()
@
. The built-in function
\verb
@
vars()
@
returns
function
\verb
@
eval()
@
. The built-in function
s
\verb
@
globals()
@
and
the current local dictionary, which may be useful to pass around for
\verb
@
locals()
@
return the current global and local dictionary,
use by
\verb
@
exec
@
.
respectively, which may be useful to pass around for
use by
\verb
@
exec
@
.
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