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
f02c5f3d
Kaydet (Commit)
f02c5f3d
authored
Eyl 15, 2008
tarafından
Skip Montanaro
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Review usage. Fix a mistake in the new-style class definition. Add a
couple new definitions (CPython and virtual machine).
üst
0c280c01
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
85 deletions
+104
-85
glossary.rst
Doc/glossary.rst
+104
-85
No files found.
Doc/glossary.rst
Dosyayı görüntüle @
f02c5f3d
...
@@ -9,16 +9,17 @@ Glossary
...
@@ -9,16 +9,17 @@ Glossary
.. glossary::
.. glossary::
``>>>``
``>>>``
The
typical
Python prompt of the interactive shell. Often seen for code
The
default
Python prompt of the interactive shell. Often seen for code
examples
that can be tried right awa
y in the interpreter.
examples
which can be executed interactivel
y in the interpreter.
``...``
``...``
The typical Python prompt of the interactive shell when entering code for
The default Python prompt of the interactive shell when entering code for
an indented code block.
an indented code block or within a pair of matching left and right
delimiters (parentheses, square brackets or curly braces).
2to3
2to3
A tool that tries to convert Python 2.x code to Python 3.x code by
A tool that tries to convert Python 2.x code to Python 3.x code by
handling most of the incompatibilites
that
can be detected by parsing the
handling most of the incompatibilites
which
can be detected by parsing the
source and traversing the parse tree.
source and traversing the parse tree.
2to3 is available in the standard library as :mod:`lib2to3`; a standalone
2to3 is available in the standard library as :mod:`lib2to3`; a standalone
...
@@ -34,12 +35,13 @@ Glossary
...
@@ -34,12 +35,13 @@ Glossary
ABC with the :mod:`abc` module.
ABC with the :mod:`abc` module.
argument
argument
A value passed to a function or method, assigned to a name local to
A value passed to a function or method, assigned to a named local
the body. A function or method may have both positional arguments and
variable in the function body. A function or method may have both
keyword arguments in its definition. Positional and keyword arguments
positional arguments and keyword arguments in its definition.
may be variable-length: ``*`` accepts or passes (if in the function
Positional and keyword arguments may be variable-length: ``*`` accepts
definition or call) several positional arguments in a list, while ``**``
or passes (if in the function definition or call) several positional
does the same for keyword arguments in a dictionary.
arguments in a list, while ``**`` does the same for keyword arguments
in a dictionary.
Any expression may be used within the argument list, and the evaluated
Any expression may be used within the argument list, and the evaluated
value is passed to the local variable.
value is passed to the local variable.
...
@@ -53,12 +55,12 @@ Glossary
...
@@ -53,12 +55,12 @@ Glossary
of a Python program in the interpreter. The bytecode is also cached in
of a Python program in the interpreter. The bytecode is also cached in
``.pyc`` and ``.pyo`` files so that executing the same file is faster the
``.pyc`` and ``.pyo`` files so that executing the same file is faster the
second time (recompilation from source to bytecode can be avoided). This
second time (recompilation from source to bytecode can be avoided). This
"intermediate language" is said to run on a
"virtual machine" that calls
"intermediate language" is said to run on a
:term:`virtual machine`
th
e subroutines
corresponding to each bytecode.
th
at executes the machine code
corresponding to each bytecode.
classic class
classic class
Any class which does not inherit from :class:`object`. See
Any class which does not inherit from :class:`object`. See
:term:`new-style class`.
:term:`new-style class`.
Classic classes will be removed in Python 3.0.
coercion
coercion
The implicit conversion of an instance of one type to another during an
The implicit conversion of an instance of one type to another during an
...
@@ -86,10 +88,15 @@ Glossary
...
@@ -86,10 +88,15 @@ Glossary
it's almost certain you can safely ignore them.
it's almost certain you can safely ignore them.
context manager
context manager
An object
s that
controls the environment seen in a :keyword:`with`
An object
which
controls the environment seen in a :keyword:`with`
statement by defining :meth:`__enter__` and :meth:`__exit__` methods.
statement by defining :meth:`__enter__` and :meth:`__exit__` methods.
See :pep:`343`.
See :pep:`343`.
CPython
The canonical implementation of the Python programming language. The
term "CPython" is used in contexts when necessary to distinguish this
implementation from others such as Jython or IronPython.
decorator
decorator
A function returning another function, usually applied as a function
A function returning another function, usually applied as a function
transformation using the ``@wrapper`` syntax. Common examples for
transformation using the ``@wrapper`` syntax. Common examples for
...
@@ -107,7 +114,7 @@ Glossary
...
@@ -107,7 +114,7 @@ Glossary
...
...
descriptor
descriptor
Any *new-style* object
that
defines the methods :meth:`__get__`,
Any *new-style* object
which
defines the methods :meth:`__get__`,
:meth:`__set__`, or :meth:`__delete__`. When a class attribute is a
:meth:`__set__`, or :meth:`__delete__`. When a class attribute is a
descriptor, its special binding behavior is triggered upon attribute
descriptor, its special binding behavior is triggered upon attribute
lookup. Normally, using *a.b* to get, set or delete an attribute looks up
lookup. Normally, using *a.b* to get, set or delete an attribute looks up
...
@@ -121,20 +128,20 @@ Glossary
...
@@ -121,20 +128,20 @@ Glossary
dictionary
dictionary
An associative array, where arbitrary keys are mapped to values. The use
An associative array, where arbitrary keys are mapped to values. The use
of :class:`dict`
much
resembles that for :class:`list`, but the keys can
of :class:`dict`
closely
resembles that for :class:`list`, but the keys can
be any object with a :meth:`__hash__` function, not just integers
starting
be any object with a :meth:`__hash__` function, not just integers
.
from zero.
Called a hash in Perl.
Called a hash in Perl.
docstring
docstring
A
docstring ("documentation string") is a string literal that appears as
A
string literal which appears as the first expression in a class,
the first thing in a class or function suite. While ignored when the
function or module. While ignored when the suite is executed, it is
suite is executed, it is recognized by the compiler and put into th
e
recognized by the compiler and put into the :attr:`__doc__` attribut
e
:attr:`__doc__` attribute of the class or function. Since it is available
of the enclosing class, function or module. Since it is available via
via
introspection, it is the canonical place for documentation of the
introspection, it is the canonical place for documentation of the
object.
object.
duck-typing
duck-typing
Pythonic programming style that
determines an object's type by inspection
A pythonic programming style which
determines an object's type by inspection
of its method or attribute signature rather than by explicit relationship
of its method or attribute signature rather than by explicit relationship
to some type object ("If it looks like a duck and quacks like a duck, it
to some type object ("If it looks like a duck and quacks like a duck, it
must be a duck.") By emphasizing interfaces rather than specific types,
must be a duck.") By emphasizing interfaces rather than specific types,
...
@@ -149,20 +156,20 @@ Glossary
...
@@ -149,20 +156,20 @@ Glossary
style assumes the existence of valid keys or attributes and catches
style assumes the existence of valid keys or attributes and catches
exceptions if the assumption proves false. This clean and fast style is
exceptions if the assumption proves false. This clean and fast style is
characterized by the presence of many :keyword:`try` and :keyword:`except`
characterized by the presence of many :keyword:`try` and :keyword:`except`
statements. The technique contrasts with the :term:`LBYL` style
that is
statements. The technique contrasts with the :term:`LBYL` style
common
in
many other languages such as C.
common
to
many other languages such as C.
expression
expression
A piece of syntax which can be evaluated to some value. In other words,
A piece of syntax which can be evaluated to some value. In other words,
an expression is an accumulation of expression elements like literals, names,
an expression is an accumulation of expression elements like literals, names,
attribute access, operators or function calls
that
all return a value.
attribute access, operators or function calls
which
all return a value.
In contrast to
other languages, not all language constructs are expressions,
In contrast to
many other languages, not all language constructs are expressions.
but there are also :term:`statement`\s that
cannot be used as expressions,
There are also :term:`statement`\s which
cannot be used as expressions,
such as :keyword:`print` or :keyword:`if`. Assignments are also
not
such as :keyword:`print` or :keyword:`if`. Assignments are also
statements,
expressions.
not
expressions.
extension module
extension module
A module written in C, using Python's C API to interact with the core and
A module written in C
or C++
, using Python's C API to interact with the core and
with user code.
with user code.
function
function
...
@@ -193,10 +200,10 @@ Glossary
...
@@ -193,10 +200,10 @@ Glossary
collector that is able to detect and break reference cycles.
collector that is able to detect and break reference cycles.
generator
generator
A function
that
returns an iterator. It looks like a normal function
A function
which
returns an iterator. It looks like a normal function
except that values are returned to the caller using a :keyword:`yield`
except that values are returned to the caller using a :keyword:`yield`
statement instead of a :keyword:`return` statement. Generator functions
statement instead of a :keyword:`return` statement. Generator functions
often contain one or more :keyword:`for` or :keyword:`while` loops
that
often contain one or more :keyword:`for` or :keyword:`while` loops
which
:keyword:`yield` elements back to the caller. The function execution is
:keyword:`yield` elements back to the caller. The function execution is
stopped at the :keyword:`yield` keyword (returning the result) and is
stopped at the :keyword:`yield` keyword (returning the result) and is
resumed there when the next element is requested by calling the
resumed there when the next element is requested by calling the
...
@@ -217,39 +224,41 @@ Glossary
...
@@ -217,39 +224,41 @@ Glossary
See :term:`global interpreter lock`.
See :term:`global interpreter lock`.
global interpreter lock
global interpreter lock
The lock used by Python threads to assure that only one thread can be run
The lock used by Python threads to assure that only one thread
at a time. This simplifies Python by assuring that no two processes can
executes in the :term:`CPython` :term:`virtual machine` at a time.
access the same memory at the same time. Locking the entire interpreter
This simplifies the CPython implementation by assuring that no two
makes it easier for the interpreter to be multi-threaded, at the expense
processes can access the same memory at the same time. Locking the
of some parallelism on multi-processor machines. Efforts have been made
entire interpreter makes it easier for the interpreter to be
in the past to create a "free-threaded" interpreter (one which locks
multi-threaded, at the expense of much of the parallelism afforded by
shared data at a much finer granularity), but performance suffered in the
multi-processor machines. Efforts have been made in the past to
common single-processor case.
create a "free-threaded" interpreter (one which locks shared data at a
much finer granularity), but so far none have been successful because
performance suffered in the common single-processor case.
hashable
hashable
An object is *hashable* if it has a hash value
that
never changes during
An object is *hashable* if it has a hash value
which
never changes during
its lifetime (it needs a :meth:`__hash__` method), and can be compared to
its lifetime (it needs a :meth:`__hash__` method), and can be compared to
other objects (it needs an :meth:`__eq__` or :meth:`__cmp__` method).
other objects (it needs an :meth:`__eq__` or :meth:`__cmp__` method).
Hashable objects
that
compare equal must have the same hash value.
Hashable objects
which
compare equal must have the same hash value.
Hashability makes an object usable as a dictionary key and a set member,
Hashability makes an object usable as a dictionary key and a set member,
because these data structures use the hash value internally.
because these data structures use the hash value internally.
All of Python's immutable built-in objects are hashable, while
all
mutable
All of Python's immutable built-in objects are hashable, while
no
mutable
containers (such as lists or dictionaries) are
not. Objects that
are
containers (such as lists or dictionaries) are
. Objects which
are
instances of user-defined classes are hashable by default; they all
instances of user-defined classes are hashable by default; they all
compare unequal, and their hash value is their :func:`id`.
compare unequal, and their hash value is their :func:`id`.
IDLE
IDLE
An Integrated Development Environment for Python. IDLE is a basic editor
An Integrated Development Environment for Python. IDLE is a basic editor
and interpreter environment
that
ships with the standard distribution of
and interpreter environment
which
ships with the standard distribution of
Python. Good for beginners, it also serves as clear example code for
Python. Good for beginners, it also serves as clear example code for
those wanting to implement a moderately sophisticated, multi-platform GUI
those wanting to implement a moderately sophisticated, multi-platform GUI
application.
application.
immutable
immutable
An object with
fixed value. Immutable objects are numbers, strings or
An object with
a fixed value. Immutable objects include numbers, strings and
tuples
(and more)
. Such an object cannot be altered. A new object has to
tuples. Such an object cannot be altered. A new object has to
be created if a different value has to be stored. They play an important
be created if a different value has to be stored. They play an important
role in places where a constant hash value is needed, for example as a key
role in places where a constant hash value is needed, for example as a key
in a dictionary.
in a dictionary.
...
@@ -267,18 +276,21 @@ Glossary
...
@@ -267,18 +276,21 @@ Glossary
instead of the ``/`` operator. See also :term:`__future__`.
instead of the ``/`` operator. See also :term:`__future__`.
interactive
interactive
Python has an interactive interpreter which means that you can try out
Python has an interactive interpreter which means you can enter
things and immediately see their results. Just launch ``python`` with no
statements and expressions at the interpreter prompt, immediately
arguments (possibly by selecting it from your computer's main menu). It is
execute them and see their results. Just launch ``python`` with no
a very powerful way to test out new ideas or inspect modules and packages
arguments (possibly by selecting it from your computer's main
(remember ``help(x)``).
menu). It is a very powerful way to test out new ideas or inspect
modules and packages (remember ``help(x)``).
interpreted
interpreted
Python is an interpreted language, as opposed to a compiled one. This
Python is an interpreted language, as opposed to a compiled one,
means that the source files can be run directly without first creating an
though the distinction can be blurry because of the presence of the
executable which is then run. Interpreted languages typically have a
bytecode compiler. This means that source files can be run directly
shorter development/debug cycle than compiled ones, though their programs
without explicitly creating an executable which is then run.
generally also run more slowly. See also :term:`interactive`.
Interpreted languages typically have a shorter development/debug cycle
than compiled ones, though their programs generally also run more
slowly. See also :term:`interactive`.
iterable
iterable
A container object capable of returning its members one at a
A container object capable of returning its members one at a
...
@@ -299,13 +311,13 @@ Glossary
...
@@ -299,13 +311,13 @@ Glossary
iterator
iterator
An object representing a stream of data. Repeated calls to the iterator's
An object representing a stream of data. Repeated calls to the iterator's
:meth:`next` method return successive items in the stream. When no more
:meth:`next` method return successive items in the stream. When no more
data
is
available a :exc:`StopIteration` exception is raised instead. At
data
are
available a :exc:`StopIteration` exception is raised instead. At
this point, the iterator object is exhausted and any further calls to its
this point, the iterator object is exhausted and any further calls to its
:meth:`next` method just raise :exc:`StopIteration` again. Iterators are
:meth:`next` method just raise :exc:`StopIteration` again. Iterators are
required to have an :meth:`__iter__` method that returns the iterator
required to have an :meth:`__iter__` method that returns the iterator
object itself so every iterator is also iterable and may be used in most
object itself so every iterator is also iterable and may be used in most
places where other iterables are accepted. One notable exception is code
places where other iterables are accepted. One notable exception is code
that
attempts multiple iteration passes. A container object (such as a
which
attempts multiple iteration passes. A container object (such as a
:class:`list`) produces a fresh new iterator each time you pass it to the
:class:`list`) produces a fresh new iterator each time you pass it to the
:func:`iter` function or use it in a :keyword:`for` loop. Attempting this
:func:`iter` function or use it in a :keyword:`for` loop. Attempting this
with an iterator will just return the same exhausted iterator object used
with an iterator will just return the same exhausted iterator object used
...
@@ -331,15 +343,15 @@ Glossary
...
@@ -331,15 +343,15 @@ Glossary
:keyword:`if` statements.
:keyword:`if` statements.
list comprehension
list comprehension
A compact way to process all or
a subset of
elements in a sequence and
A compact way to process all or
part of the
elements in a sequence and
return a list with the results. ``result = ["0x%02x" % x for x in
return a list with the results. ``result = ["0x%02x" % x for x in
range(256) if x % 2 == 0]`` generates a list of strings containing
hex
range(256) if x % 2 == 0]`` generates a list of strings containing
numbers (0x..) that are even and in the range from 0 to 255. The
even hex numbers (0x..) in the range from 0 to 255. The :keyword:`if`
:keyword:`if` clause is optional. If omitted, all elements in
clause is optional. If omitted, all elements in ``range(256)`` are
``range(256)`` are
processed.
processed.
mapping
mapping
A container object (such as :class:`dict`)
that
supports arbitrary key
A container object (such as :class:`dict`)
which
supports arbitrary key
lookups using the special method :meth:`__getitem__`.
lookups using the special method :meth:`__getitem__`.
metaclass
metaclass
...
@@ -356,7 +368,7 @@ Glossary
...
@@ -356,7 +368,7 @@ Glossary
More information can be found in :ref:`metaclasses`.
More information can be found in :ref:`metaclasses`.
method
method
A function
that
is defined inside a class body. If called as an attribute
A function
which
is defined inside a class body. If called as an attribute
of an instance of that class, the method will get the instance object as
of an instance of that class, the method will get the instance object as
its first :term:`argument` (which is usually called ``self``).
its first :term:`argument` (which is usually called ``self``).
See :term:`function` and :term:`nested scope`.
See :term:`function` and :term:`nested scope`.
...
@@ -366,7 +378,7 @@ Glossary
...
@@ -366,7 +378,7 @@ Glossary
also :term:`immutable`.
also :term:`immutable`.
named tuple
named tuple
Any tuple subclass whose indexable
fields are also accessible with
Any tuple subclass whose indexable
elements are also accessible using
named attributes (for example, :func:`time.localtime` returns a
named attributes (for example, :func:`time.localtime` returns a
tuple-like object where the *year* is accessible either with an
tuple-like object where the *year* is accessible either with an
index such as ``t[0]`` or with a named attribute like ``t.tm_year``).
index such as ``t[0]`` or with a named attribute like ``t.tm_year``).
...
@@ -388,7 +400,7 @@ Glossary
...
@@ -388,7 +400,7 @@ Glossary
it clear which module implements a function. For instance, writing
it clear which module implements a function. For instance, writing
:func:`random.seed` or :func:`itertools.izip` makes it clear that those
:func:`random.seed` or :func:`itertools.izip` makes it clear that those
functions are implemented by the :mod:`random` and :mod:`itertools`
functions are implemented by the :mod:`random` and :mod:`itertools`
modules respectively.
modules
,
respectively.
nested scope
nested scope
The ability to refer to a variable in an enclosing definition. For
The ability to refer to a variable in an enclosing definition. For
...
@@ -399,11 +411,10 @@ Glossary
...
@@ -399,11 +411,10 @@ Glossary
scope. Likewise, global variables read and write to the global namespace.
scope. Likewise, global variables read and write to the global namespace.
new-style class
new-style class
Any class
that
inherits from :class:`object`. This includes all built-in
Any class
which
inherits from :class:`object`. This includes all built-in
types like :class:`list` and :class:`dict`. Only new-style classes can
types like :class:`list` and :class:`dict`. Only new-style classes can
use Python's newer, versatile features like :attr:`__slots__`,
use Python's newer, versatile features like :attr:`__slots__`,
descriptors, properties, :meth:`__getattribute__`, class methods, and
descriptors, properties, and :meth:`__getattribute__`.
static methods.
More information can be found in :ref:`newstyle`.
More information can be found in :ref:`newstyle`.
...
@@ -420,11 +431,12 @@ Glossary
...
@@ -420,11 +431,12 @@ Glossary
is also abbreviated "Py3k".
is also abbreviated "Py3k".
Pythonic
Pythonic
An idea or piece of code which closely follows the most common idioms of
An idea or piece of code which closely follows the most common idioms
the Python language, rather than implementing code using concepts common
of the Python language, rather than implementing code using concepts
in other languages. For example, a common idiom in Python is the :keyword:`for`
common to other languages. For example, a common idiom in Python is
loop structure; other languages don't have this easy keyword, so people
to loop over all elements of an iterable using a :keyword:`for`
use a numerical counter instead::
statement. Many other languages don't have this type of construct, so
people unfamiliar with Python sometimes use a numerical counter instead::
for i in range(len(food)):
for i in range(len(food)):
print food[i]
print food[i]
...
@@ -435,11 +447,13 @@ Glossary
...
@@ -435,11 +447,13 @@ Glossary
print piece
print piece
reference count
reference count
The number of places where a certain object is referenced to. When the
The number of references to an object. When the reference count of an
reference count drops to zero, an object is deallocated. While reference
object drops to zero, it is deallocated. Reference counting is
counting is invisible on the Python code level, it is used on the
generally not visible to Python code, but it is a key element of the
implementation level to keep track of allocated memory.
:term:`CPython` implementation. The :mod:`sys` module defines a
:func:`getrefcount` function that programmers can call to return the
reference count for a particular object.
__slots__
__slots__
A declaration inside a :term:`new-style class` that saves memory by
A declaration inside a :term:`new-style class` that saves memory by
pre-declaring space for instance attributes and eliminating instance
pre-declaring space for instance attributes and eliminating instance
...
@@ -449,7 +463,8 @@ Glossary
...
@@ -449,7 +463,8 @@ Glossary
sequence
sequence
An :term:`iterable` which supports efficient element access using integer
An :term:`iterable` which supports efficient element access using integer
indices via the :meth:`__getitem__` and :meth:`__len__` special methods.
indices via the :meth:`__getitem__` special method and defines a
:meth:`len` method that returns the length of the sequence.
Some built-in sequence types are :class:`list`, :class:`str`,
Some built-in sequence types are :class:`list`, :class:`str`,
:class:`tuple`, and :class:`unicode`. Note that :class:`dict` also
:class:`tuple`, and :class:`unicode`. Note that :class:`dict` also
supports :meth:`__getitem__` and :meth:`__len__`, but is considered a
supports :meth:`__getitem__` and :meth:`__len__`, but is considered a
...
@@ -472,6 +487,10 @@ Glossary
...
@@ -472,6 +487,10 @@ Glossary
The type of a Python object determines what kind of object it is; every
The type of a Python object determines what kind of object it is; every
object has a type. An object's type is accessible as its
object has a type. An object's type is accessible as its
:attr:`__class__` attribute or can be retrieved with ``type(obj)``.
:attr:`__class__` attribute or can be retrieved with ``type(obj)``.
virtual machine
A computer defined entirely in software. Python's virtual machine
executes the :term:`bytecode` emitted by the bytecode compiler.
Zen of Python
Zen of Python
Listing of Python design principles and philosophies that are helpful in
Listing of Python design principles and philosophies that are helpful in
...
...
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