Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ea6e19c

Browse files
committed
added code objects
1 parent 3d54de2 commit ea6e19c

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

Doc/lib/libtypes.tex

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ \subsubsection{Functions.}
505505
\var{m} is the module in which the function \var{f} was defined).
506506

507507
\subsubsection{Methods.}
508+
\obindex{method}
508509

509510
Methods are functions that are called using the attribute notation.
510511
There are two flavors: built-in methods (such as \code{append()} on
@@ -521,6 +522,27 @@ \subsubsection{Methods.}
521522

522523
(See the Python Reference Manual for more info.)
523524

525+
\subsubsection{Code Objects.}
526+
\obindex{code}
527+
528+
Code objects are used by the implementation to represent
529+
``pseudo-compiled'' executable Python code such as a function body.
530+
They differ from function objects because they don't contain a
531+
reference to their global execution environment. Code objects are
532+
returned by the built-in \code{compile()} function and can be
533+
extracted from function objects through their \code{func_code}
534+
attribute.
535+
\bifuncindex{compile}
536+
\ttindex{func_code}
537+
538+
A code object can be executed or evaluated by passing it (instead of a
539+
source string) to the \code{exec} statement or the built-in
540+
\code{eval()} function.
541+
\stindex{exec}
542+
\bifuncindex{eval}
543+
544+
(See the Python Reference Manual for more info.)
545+
524546
\subsubsection{Type Objects.}
525547

526548
Type objects represent the various object types. An object's type is

Doc/libtypes.tex

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ \subsubsection{Functions.}
505505
\var{m} is the module in which the function \var{f} was defined).
506506

507507
\subsubsection{Methods.}
508+
\obindex{method}
508509

509510
Methods are functions that are called using the attribute notation.
510511
There are two flavors: built-in methods (such as \code{append()} on
@@ -521,6 +522,27 @@ \subsubsection{Methods.}
521522

522523
(See the Python Reference Manual for more info.)
523524

525+
\subsubsection{Code Objects.}
526+
\obindex{code}
527+
528+
Code objects are used by the implementation to represent
529+
``pseudo-compiled'' executable Python code such as a function body.
530+
They differ from function objects because they don't contain a
531+
reference to their global execution environment. Code objects are
532+
returned by the built-in \code{compile()} function and can be
533+
extracted from function objects through their \code{func_code}
534+
attribute.
535+
\bifuncindex{compile}
536+
\ttindex{func_code}
537+
538+
A code object can be executed or evaluated by passing it (instead of a
539+
source string) to the \code{exec} statement or the built-in
540+
\code{eval()} function.
541+
\stindex{exec}
542+
\bifuncindex{eval}
543+
544+
(See the Python Reference Manual for more info.)
545+
524546
\subsubsection{Type Objects.}
525547

526548
Type objects represent the various object types. An object's type is

0 commit comments

Comments
 (0)