diff options
Diffstat (limited to 'Doc/glossary.rst')
-rw-r--r-- | Doc/glossary.rst | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/Doc/glossary.rst b/Doc/glossary.rst index 2894f35..0eb3111 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,11 +67,11 @@ Glossary A template for creating user-defined objects. Class definitions normally contain method definitions which operate on instances of the class. - + classic class Any class which does not inherit from :class:`object`. See :term:`new-style class`. Classic classes will be removed in Python 3.0. - + 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, @@ -84,7 +84,7 @@ Glossary ``operator.add(3.0, 4.5)``. 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 @@ -96,7 +96,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. @@ -138,7 +138,7 @@ Glossary class methods, static methods, 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 @@ -152,8 +152,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 @@ -163,13 +163,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 @@ -195,14 +195,14 @@ Glossary which are not compatible with the current interpreter. For example, the expression ``11/4`` currently evaluates to ``2``. If the module in which it is executed had enabled *true division* by executing:: - + from __future__ import division - + the expression ``11/4`` would evaluate to ``2.75``. 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 will become the default:: - + >>> import __future__ >>> __future__.division _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192) @@ -211,7 +211,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` @@ -221,21 +221,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. @@ -261,21 +261,21 @@ 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 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 in a dictionary. - + integer division Mathematical division discarding any remainder. For example, the expression ``11/4`` currently evaluates to ``2`` in contrast to the @@ -287,7 +287,7 @@ Glossary divided by a float will result in a float value, possibly with a decimal fraction. Integer division can be forced by using the ``//`` operator instead of the ``/`` operator. See also :term:`__future__`. - + interactive Python has an interactive interpreter which means you can enter statements and expressions at the interpreter prompt, immediately @@ -295,7 +295,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 @@ -304,7 +304,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 @@ -320,7 +320,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` method return successive items in the stream. When no more @@ -335,7 +335,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 @@ -359,7 +359,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 @@ -367,11 +367,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 @@ -390,7 +390,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`. @@ -407,7 +407,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 @@ -419,7 +419,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 @@ -427,7 +427,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 Any class which inherits from :class:`object`. This includes all built-in types like :class:`list` and :class:`dict`. Only new-style classes can @@ -440,7 +440,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 @@ -448,7 +448,7 @@ Glossary definition), or pass several arguments as a list to a function. See :term:`argument`. - Python 3000 + Python 3000 Nickname for the next major Python version, 3.0 (coined long ago when the release of version 3 was something in the distant future.) This is also abbreviated "Py3k". @@ -460,7 +460,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] @@ -483,7 +483,7 @@ Glossary dictionaries. Though 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 @@ -529,7 +529,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 |