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
13c8ef62
Kaydet (Commit)
13c8ef62
authored
May 29, 1998
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Say a bit more about .pyc and .pyo files.
üst
3c46234e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
5 deletions
+35
-5
tut.tex
Doc/tut/tut.tex
+35
-5
No files found.
Doc/tut/tut.tex
Dosyayı görüntüle @
13c8ef62
...
@@ -1876,7 +1876,7 @@ module search path. See the section on Standard Modules later.
...
@@ -1876,7 +1876,7 @@ module search path. See the section on Standard Modules later.
As an important speed-up of the start-up time for short programs that
As an important speed-up of the start-up time for short programs that
use a lot of standard modules, if a file called
\file
{
spam.pyc
}
exists
use a lot of standard modules, if a file called
\file
{
spam.pyc
}
exists
in the directory where
\file
{
spam.py
}
is found, this is assumed to
in the directory where
\file
{
spam.py
}
is found, this is assumed to
contain an already-``compiled'' version of the module
\module
{
spam
}
.
contain an already-``
byte-
compiled'' version of the module
\module
{
spam
}
.
The modification time of the version of
\file
{
spam.py
}
used to create
The modification time of the version of
\file
{
spam.py
}
used to create
\file
{
spam.pyc
}
is recorded in
\file
{
spam.pyc
}
, and the file is
\file
{
spam.pyc
}
is recorded in
\file
{
spam.pyc
}
, and the file is
ignored if these don't match.
ignored if these don't match.
...
@@ -1888,11 +1888,41 @@ this attempt fails; if for any reason the file is not written
...
@@ -1888,11 +1888,41 @@ this attempt fails; if for any reason the file is not written
completely, the resulting
\file
{
spam.pyc
}
file will be recognized as
completely, the resulting
\file
{
spam.pyc
}
file will be recognized as
invalid and thus ignored later. The contents of the
\file
{
spam.pyc
}
invalid and thus ignored later. The contents of the
\file
{
spam.pyc
}
file is platform independent, so a Python module directory can be
file is platform independent, so a Python module directory can be
shared by machines of different architectures. (Tip for experts:
shared by machines of different architectures.
the module
\module
{
compileall
}
\refstmodindex
{
compileall
}
creates
\file
{
.pyc
}
files for all modules.)
Some tips for experts:
\begin{itemize}
\item
When the Python interpreter is invoked with the
\code
{
-O
}
flag,
optimized code is generated and stored in
\file
{
.pyo
}
files.
The optimizer currently doesn't help much; it only removes
\keyword
{
assert
}
statements and
\code
{
SET
_
LINENO
}
instructions.
When
\code
{
-O
}
is used,
\emph
{
all
}
bytecode is optimized;
\code
{
.pyc
}
files are ignored and
\code
{
.py
}
files are compiled to optimized
bytecode.
\item
A program doesn't run any faster when it is read from a
\file
{
.pyc
}
or
\file
{
.pyo
}
file than when it is read from a
\file
{
.py
}
file; the only thing that's faster about
\file
{
.pyc
}
or
\file
{
.pyo
}
files is the speed with which they are loaded.
\item
It is possible to have a file called
\file
{
spam.pyc
}
(or
\file
{
spam.pyo
}
when
\code
{
-O
}
is used) without a module
\file
{
spam.py
}
in the same module. This can be used to distribute
a library of Python code in a form that is moderately hard to reverse
engineer.
\item
The module
\module
{
compileall
}
\refstmodindex
{
compileall
}
can create
\file
{
.pyc
}
files (or
\file
{
.pyo
}
files when
\code
{
-O
}
is used) for
all modules in a directory.
\end{itemize}
% XXX Should optimization with -O be covered here?
\section
{
Standard Modules
}
\section
{
Standard Modules
}
\label
{
standardModules
}
\label
{
standardModules
}
...
...
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