diff options
Diffstat (limited to 'Doc/glossary.rst')
-rw-r--r-- | Doc/glossary.rst | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/Doc/glossary.rst b/Doc/glossary.rst index eb2614f2dd..9e3cbeb92a 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -11,7 +11,7 @@ Glossary ``>>>`` The default Python prompt of the interactive shell. Often seen for code examples which can be executed interactively in the interpreter. - + ``...`` The default Python prompt of the interactive shell when entering code for an indented code block or within a pair of matching left and right @@ -50,11 +50,11 @@ Glossary A value associated with an object which is referenced by name using dotted expressions. For example, if an object *o* has an attribute *a* it would be referenced as *o.a*. - + BDFL Benevolent Dictator For Life, a.k.a. `Guido van Rossum <http://www.python.org/~guido/>`_, Python's creator. - + bytecode Python source code is compiled into bytecode, the internal representation of a Python program in the interpreter. The bytecode is also cached in @@ -67,7 +67,7 @@ Glossary A template for creating user-defined objects. Class definitions normally contain method definitions which operate on instances of the class. - + coercion The implicit conversion of an instance of one type to another during an operation which involves two arguments of the same type. For example, @@ -77,7 +77,7 @@ Glossary will raise a ``TypeError``. Without coercion, all arguments of even compatible types would have to be normalized to the same value by the programmer, e.g., ``float(3)+4.5`` rather than just ``3+4.5``. - + complex number An extension of the familiar real number system in which all numbers are expressed as a sum of a real part and an imaginary part. Imaginary @@ -89,7 +89,7 @@ Glossary :mod:`math` module, use :mod:`cmath`. Use of complex numbers is a fairly advanced mathematical feature. If you're not aware of a need for them, it's almost certain you can safely ignore them. - + context manager An object which controls the environment seen in a :keyword:`with` statement by defining :meth:`__enter__` and :meth:`__exit__` methods. @@ -132,7 +132,7 @@ Glossary and reference to super classes. For more information about descriptors' methods, see :ref:`descriptors`. - + dictionary An associative array, where arbitrary keys are mapped to values. The use of :class:`dict` closely resembles that for :class:`list`, but the keys can @@ -146,8 +146,8 @@ Glossary of the enclosing class, function or module. Since it is available via introspection, it is the canonical place for documentation of the object. - - duck-typing + + duck-typing A pythonic programming style which determines an object's type by inspection 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 @@ -157,13 +157,13 @@ Glossary :func:`isinstance`. (Note, however, that duck-typing can be complemented with abstract base classes.) Instead, it typically employs :func:`hasattr` tests or :term:`EAFP` programming. - + EAFP Easier to ask for forgiveness than permission. This common Python coding style assumes the existence of valid keys or attributes and catches exceptions if the assumption proves false. This clean and fast style is characterized by the presence of many :keyword:`try` and :keyword:`except` - statements. The technique contrasts with the :term:`LBYL` style + statements. The technique contrasts with the :term:`LBYL` style common to many other languages such as C. expression @@ -196,7 +196,7 @@ Glossary By importing the :mod:`__future__` module and evaluating its variables, you can see when a new feature was first added to the language and when it becomes the default:: - + >>> import __future__ >>> __future__.division _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192) @@ -205,7 +205,7 @@ Glossary The process of freeing memory when it is not used anymore. Python performs garbage collection via reference counting and a cyclic garbage collector that is able to detect and break reference cycles. - + generator A function which returns an iterator. It looks like a normal function except that values are returned to the caller using a :keyword:`yield` @@ -215,21 +215,21 @@ Glossary stopped at the :keyword:`yield` keyword (returning the result) and is resumed there when the next element is requested by calling the :meth:`__next__` method of the returned iterator. - + .. index:: single: generator expression - + generator expression An expression that returns a generator. It looks like a normal expression followed by a :keyword:`for` expression defining a loop variable, range, and an optional :keyword:`if` expression. The combined expression generates values for an enclosing function:: - + >>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81 285 - + GIL See :term:`global interpreter lock`. - + global interpreter lock The lock used by Python threads to assure that only one thread executes in the :term:`CPython` :term:`virtual machine` at a time. @@ -255,14 +255,14 @@ Glossary containers (such as lists or dictionaries) are. Objects which are instances of user-defined classes are hashable by default; they all compare unequal, and their hash value is their :func:`id`. - + IDLE An Integrated Development Environment for Python. IDLE is a basic editor and interpreter environment which ships with the standard distribution of Python. Good for beginners, it also serves as clear example code for those wanting to implement a moderately sophisticated, multi-platform GUI application. - + immutable An object with a fixed value. Immutable objects include numbers, strings and tuples. Such an object cannot be altered. A new object has to @@ -277,7 +277,7 @@ Glossary arguments (possibly by selecting it from your computer's main menu). It is a very powerful way to test out new ideas or inspect modules and packages (remember ``help(x)``). - + interpreted Python is an interpreted language, as opposed to a compiled one, though the distinction can be blurry because of the presence of the @@ -286,7 +286,7 @@ Glossary 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 A container object capable of returning its members one at a time. Examples of iterables include all sequence types (such as @@ -302,7 +302,7 @@ Glossary statement does that automatically for you, creating a temporary unnamed variable to hold the iterator for the duration of the loop. See also :term:`iterator`, :term:`sequence`, and :term:`generator`. - + iterator An object representing a stream of data. Repeated calls to the iterator's :meth:`__next__` (or passing it to the builtin function) :func:`next` @@ -318,7 +318,7 @@ Glossary :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 in the previous iteration pass, making it appear like an empty container. - + More information can be found in :ref:`typeiter`. keyword argument @@ -342,7 +342,7 @@ Glossary A built-in Python :term:`sequence`. Despite its name it is more akin to an array in other languages than to a linked list since access to elements are O(1). - + list comprehension 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 @@ -350,11 +350,11 @@ Glossary even hex numbers (0x..) in the range from 0 to 255. The :keyword:`if` clause is optional. If omitted, all elements in ``range(256)`` are processed. - + mapping A container object (such as :class:`dict`) which supports arbitrary key lookups using the special method :meth:`__getitem__`. - + metaclass The class of a class. Class definitions create a class name, a class dictionary, and a list of base classes. The metaclass is responsible for @@ -373,7 +373,7 @@ Glossary of an instance of that class, the method will get the instance object as its first :term:`argument` (which is usually called ``self``). See :term:`function` and :term:`nested scope`. - + mutable Mutable objects can change their value but keep their :func:`id`. See also :term:`immutable`. @@ -390,7 +390,7 @@ Glossary :func:`collections.namedtuple`. The latter approach automatically provides extra features such as a self-documenting representation like ``Employee(name='jones', title='programmer')``. - + namespace The place where a variable is stored. Namespaces are implemented as dictionaries. There are the local, global and builtin namespaces as well @@ -402,7 +402,7 @@ Glossary :func:`random.seed` or :func:`itertools.izip` makes it clear that those functions are implemented by the :mod:`random` and :mod:`itertools` modules, respectively. - + nested scope The ability to refer to a variable in an enclosing definition. For instance, a function defined inside another function can refer to @@ -410,7 +410,7 @@ Glossary reference and not for assignment which will always write to the innermost scope. In contrast, local variables both read and write in the innermost scope. Likewise, global variables read and write to the global namespace. - + new-style class Old name for the flavor of classes now used for all class objects. In earlier Python versions, only new-style classes could use Python's newer, @@ -421,7 +421,7 @@ Glossary Any data with state (attributes or value) and defined behavior (methods). Also the ultimate base class of any :term:`new-style class`. - + positional argument The arguments assigned to local names inside a function or method, determined by the order in which they were given in the call. ``*`` is @@ -441,7 +441,7 @@ Glossary to loop over all elements of an iterable using a :keyword:`for` 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)): print(food[i]) @@ -464,7 +464,7 @@ Glossary popular, the technique is somewhat tricky to get right and is best reserved for rare cases where there are large numbers of instances in a memory-critical application. - + sequence An :term:`iterable` which supports efficient element access using integer indices via the :meth:`__getitem__` special method and defines a @@ -516,7 +516,7 @@ Glossary virtual machine A computer defined entirely in software. Python's virtual machine executes the :term:`bytecode` emitted by the bytecode compiler. - + Zen of Python Listing of Python design principles and philosophies that are helpful in understanding and using the language. The listing can be found by typing |