The following terms are used in the book and are presented here for your convenience.
A special IP address used to denote "this computer." See also localhost.
Anonymous functions and variables are not bound to names. Examples of this are the functions created by the lambda function, a list, or a tuple created but never associated with a name.
An encoding strategy defined by MIME that escapes an entire string as a whole. More efficient than quoted-printable for binary data.
A peer-to-peer protocol that distributes the cost of hosting a file among all the parties downloading it.
When code is executing, the call stack is the list of functions that your code has executed to reach that point in the program. As functions or methods are entered, the location in the file is noted along with the parameters that the function was called with, and the entry point is marked in the call stack. When a function is exited, its entry in the call stack is removed. When an exception occurs, a stack trace is printed that indicates where in the program the problem occurred.
The Common Gateway Interface: A standard for web servers that makes it easy to expose web interfaces to scripts.
(1) A class is a definition that can be used to create objects. A particular class definition contains the declarations of the data and the methods that objects that are instances of that particular class will have available to them. In Python, functions that appear within the context of a class are considered to be methods. (2) An object holds data as well as the methods that operate on that data. A class defines what data is stored and what methods are available. Python is a little looser than most programming languages, such as Java, C++, or C#, in that Python lets you break rules enforced in other languages. For example, Python, by default, lets you access data inside a class. This does violate some of the concepts of object-oriented programming but with good reason: Python aims first and foremost to be practical.
Describes an architecture in which one actor (the server) is a repository for information requested and acted upon by other actors (the clients).
Comments are text in a program that Python does not pay attention to. At any point outside of a string where a hash mark (#) appears, from that point until the end of the line, the Python interpreter ignores all text.
A MIME concept used to indicate the type of a file being sent encoded inside an e-mail message. Also used by web servers to indicate the type of file being served.
A Python API for accessing databases. The neat thing about this API is that you can use the same Python code to work with any database for which there is a DB-compliant driver. This includes Oracle, DB2, and so on. The only differences in your code will likely be the code to connect to the database, which differs by vendor.
Short for database manager, DBM libraries provide a means to persist Python dictionaries.
A data type in Python that is indexed by an arbitrary value that is set by the programmer. The value can be any kind of Python object. The index is called the "key" and the object that a key references is referred to as its "value."
Domain Name System. A service that runs on top of TCP and resolves hostnames (wrox.com
) to IP addresses (208.215.179.178).
A way of describing the vocabulary and structure of a document. Defines the data elements that will be present in a document, what relationship they have to one another, and how many of them are expected.
The Document Object Model, a tree-based API recommendation from the W3C for working with XML documents.
Document Type Definition. A specification for producing a Document Model.
See Ephemeral port.
Encapsulation is the idea that a class can hide the internal details and data necessary to perform a certain task. A class holds the necessary data, and you are not supposed to see that data under normal circumstances. Furthermore, a class provides a number of methods to operate on that data. These methods can hide the internal details, such as network protocols, disk access, and so on. Encapsulation is a technique to simplify your programs. At each step in creating your program, you can write code that concentrates on a single task. Encapsulation hides the complexity.
The act of hiding information so that it is difficult or impossible to recover without a secret password. Data is encrypted when it is recoverable. Data that is scrambled and unrecoverable should be thought of as lost instead.
High-numbered IP ports are often created to receive data over TCP/IP as part of a particular socket connection. Ephemeral ports are administered by the operating system, and have a lifetime of a single socket connection.
Special characters that begin with the backslash, such as
for a newline.
A term used in web services to denote an error condition. Similar to Python's exceptions, and generally implemented the same way as exceptions in Python are.
A floating-point number is a number with a fractional or decimal component. Fractions can be represented as decimal values using a float value. When arithmetic is done with a float and an integer, the integer will be promoted to being a float.
A function is a collection of code defined using a name, and which is invoked through that name.
An item of metadata found both in e-mail messages and in HTTP requests and responses. A header line consists of a key and value separated by a colon and a space. For instance: "Subject: Hello".
Base 16 notation, where the numbers are from 0 through 15, and are represented by the numbers 0–9. Once single digits are exhausted, the letters A–F are used. So the number 11 in hex is B.
A human-readable identifier for a computer on an IP network, for instance: wrox.com
. Hostnames are administered through DNS.
The data portion of an HTTP request or response.
The metadata portion of an HTTP request or response: a series of key-value pairs. HTTP defines some standard headers, and CGI defines some more: applications can define their own.
HyperText Transfer Protocol, the protocol devised to let web browsers and web servers communicate.
The string sent by an HTTP client to the server, requesting some operation on some resource.
The string sent by an HTTP server to a client, in response to an HTTP request. In REST terminology, it contains either a representation of a resource or a document describing action taken on a resource.
A numeric code used in an HTTP response to denote the status of the corresponding request. Forty of these are defined in the HTTP standard.
A string used in an HTTP request to describe what the client wants to do to a resource (for instance, retrieve a representation of it or modify it).
An idempotent action has no side effects. A term taken from mathematics: Multiplying a number by 1 is an idempotent action. So should be calling an object's accessor method or (in REST) making an HTTP GET request.
A special number that acts like a float but cannot be mixed freely with floats or integers. If they are mixed, a complex number is the result, not an imaginary number.
The Internet Message Access Protocol. Also known as IMAP4. A protocol for retrieving and managing mail. IMAP4 intends for you to store your mail on the server. See also POP.
A loop that has no termination clause, such as "while True:". Often, infinite loops are an accidental situation, but they can be useful as long as there are actions that will happen, and there is code being executed. One example is a server waiting for connections.
Inheritance means that a class can inherit, or gain access to, data and methods defined in a parent class. This just follows common sense in classifying a problem domain. For example, a rectangle and a circle are both shapes. In this case, the base class would be Shape. The Rectangle class would then inherit from Shape, as would the Circle class. Inheritance allows you to treat objects of both the Rectangle and Circle classes as Shapes, meaning you can write more generic code. For the most part, the base class should be general and the subclasses specialized. Oftentimes inheritance is called specialization.
An umbrella term that covers any kind of operation that reads or writes data. Writing to screen, inputting from the keyboard, and network connections are all examples of Input/Output.
Whole numbers, without a fractional or decimal component.
See Input/Output.
The location of a computer on an IP network. For instance, 208.215.179.178.
The Internet Protocol. Connects networks based on different technologies (for instance, Ethernet and wireless) into a single network.
Internet Relay Chat. A protocol for online chat rooms.
Iterators are objects that you can use in certain contexts that generate a sequence of outputs. Unlike sequence objects, an iterator like xrange doesn't have to return a finite list. The object can continue to create return values when its next method is invoked. Iterators can be used with for
loops.
Java 2 Enterprise Edition, a set of standards for writing enterprise-worthy Java applications. There are no real corresponding Python standards, but the Twisted framework and others provide enterprise-worthy features for Python.
Java Virtual Machine, the runtime engine of the Java platform. The java
command runs Java applications similar to the way the Python
command runs Python applications.
An implementation of Python written in the Java language that runs on top of the Java platform.
A list is a type of sequence, as well as being an iterator. It is similar to a tuple, except that it can be modified after it is created. A list is created by using the square brackets ([]).
A special hostname used to denote "this computer." See also 127.0.0.1.
A loop is a form of repetition where a set of operations is performed, and the operations are repeated until a set of conditions are set.
A method is a function inside the context of an object (it is also called a method when you write it inside of a class). It has automatic access to all of the data within the object that it was invoked from.
Multipurpose Internet Mail Encoding. A set of standards that make it possible to send multiple files and international and binary data through e-mail, while still complying with RFC 2822.
A module is a collection of code within a file. Modules can contain functions, named variables, and classes. When a module is used in a program, it is made available using the import built-in word, and it lives within a scope named after the module. So in a module named "mymodule"
the function "myfunction"
would be called by calling "mymodule.myfunction()
". This can be modified by the way the module is imported; importing the modifiers "from"
and "as"
can modify the behavior of import so that the module is seen as having a different name. The current module can be found by looking at the variable name "__name__"
, which is created locally in each module's scope. If __name__
is "__main__"
then the scope is currently the top-level module — that is, the program being run.
A module is just a Python source file. A module can contain variables, classes, functions, and any other element available in your Python scripts.
A MIME message that contains more than one "document" (for instance, a text message and an image).
An object is an instance of a class. Objects contain data and methods that are defined in the class. Multiple objects of the same class may exist in the same program at the same time, using different names. Each object has data that will be different from other objects of the same type. Objects are bound to a name when they are created.
Base 8 notation, where the numbers range from 0–7.
A package is a grouping of modules in a directory that contains a file called __init__.py
. Together, all the files in the directory can act together to implement a combined package that appears, when it's used, to act like a single module. The module can contain subdirectories that can also contain modules. The package offers an organizational structure for distributing more complex program structures, and it also allows for the conditional inclusion of code that may only work on one platform (for instance, if one file could not work except on a Mac OS X system, it could be put into its own file and called only after the correct platform had been verified).
Describes an architecture in which all actors have equal standing.
Polymorphism means that subclasses can override methods for more specialized behavior. For example, a Rectangle and a Circle are both Shapes. You may define a set of common operations, such as move and draw, that should apply to all shapes. But the draw method for a Circle will obviously be different from the draw method for a Rectangle. Polymorphism allows you to name both methods draw and then call these methods as if the Circle and the Rectangle were both Shapes (which they are, at least in this example).
The Post Office Protocol. Also known as POP3. A protocol for downloading e-mail from a server. POP intends that you delete the mail from the server after downloading it. See also IMAP.
Along with an IP address, a port number identifies a particular service on an Internet network.
A convention for structuring the data sent between parties on a network. HTTP and TCP/IP are examples of protocols.
A suite of protocols in which the higher-level protocols delegate to the lower-level ones.
An encoding strategy defined by MIME that escapes each non-US ASCII character individually. More efficient than Base64 for text that contains mostly U.S. ASCII characters.
In Python, strings are defined by being text within quotes. Quotes can be either single ('
), double ("
), or triple ("""
or '''
). If a string is started with a single quote, it must be ended with a single quote. A string begun with a double quote must be terminated with a double quote. A string begun with a triple quote must be terminated with a triple quote of the same kind ('''
must be matched by '''
, and """
must be matched by """
). Single and double quotes function in exactly the same way. Triple quotes are special because they can enclose multi-line strings (strings that contain newlines).
Range generates a list of numbers, by default from zero to the number it is given as a parameter, by one. It can also be instructed to start at a number other than zero and to increment in steps rather than by one.
Relational Database Management System. See Relational database.
In a relational database, data is stored in tables — two-dimensional data structures. Each table is made up of rows, also called records. Each row in turn is made up of columns. Typically, each record holds the information pertaining to one item, such as an audio CD, a person, a purchase order, an automobile, and so on.
In REST terminology, a depiction of a resource. When you request a resource, what you get back is a representation. One resource may have multiple representations. For instance, a single document resource may have HTML, PostScript, and plain-text representations.
In REST terminology, an object that can be accessed and/or manipulated from the Web. Can take a number of forms: For instance, it may be a document located on the server, a row in a database, or even a physical object (such as an item you order in an online store).
A string that uniquely identifies a resource. Generally equivalent to a URL. One resource may have multiple identifiers.
REpresentational State Transfer, a name for the architecture of the World Wide Web.
An informal metric of how well a web application conforms to the design.
The standard format for Internet e-mail messages. Requires that e-mail messages be formatted in U.S. ASCII.
A script that makes HTTP requests while not under the direct control of a human.
Rich Site Summary, or RDF Site Summary. An XML-based format for syndicating content.
The Simple API for XML. A stream-based XML parser.
Names of data and code; variable names, class names, function names, and so on, which have different levels of visibility. Names that are visible within a function or method are either in their scope or come from a scope that is at a level above the scope of the operation accessing it.
A sequence is a category of data types. A sequence can refer to any type of object that contains an ordered numerical index, starting from zero, which contains references to values. Each value referenced from an index number can be any Python object that could normally be referenced by a variable name. Elements in a sequence are de-referenced by using the square brackets after the name of the sequence. So for a sequence named "seq," the fourth element is de-referenced when you see "seq[3]". It is 3 instead of 4 because the first index number of the sequence is 0.
Simple Mail Transport Protocol. The standard protocol for sending Internet e-mail.
Originally stood for Simple Object Access Protocol. A standard for making web service calls, similar to XML-RPC but more formally defined.
A two-way connection over an IP network. Sockets allow programmers to treat network connections like files.
Robot that, given a starting web page, follows links to find other web pages to operate on. Most search engines have implemented spiders.
Structured query language, pronounced either sequel or S-Q-L. Language used to access relational databases.
Secure Socket Layer. A protocol that runs between TCP/IP and some other protocol (such as SMTP or HTTP), providing end-to-end encryption.
See Call stack.
Any combination of letters or numbers enclosed in quotation marks (either single, double, or a series of three single or double quotes together). Strings are made up of multiple instances of characters (a character is a data type that holds a single letter or number enclosed in quotation marks). In Python 3.1 there are two types of strings: str and bytes. The str type holds text, while the bytes type holds data. If you wish to blend the two types together, you must explicitly convert between the two. If you want to convert a string to a byte you would use str.encode(); to go from a byte to a string you would use bytes.decode().
A term used to describe a very common protocol stack: TCP running on top of IP.
Transport Control Protocol: Makes reliable, orderly communication possible between two points on an IP network.
A tuple is a type of sequence as well as an iterator. A tuple is similar to a list, except that once a tuple has been defined, the number of elements, and the references to elements in it, cannot be changed (however, if it references an object whose data you can change, such as a list or a dictionary, the data within that other type can still be changed). Tuples are created with the parentheses "()". When you create a tuple that has only one element, you must put a comma after that single element. Failing to do this will create a string.
Unique ID. Used in a variety of contexts to denote an ID that is unique and stable over time.
Unicode is a system for encoding strings so that the original letters can be determined, even if someone using a different character encoding, by default, reads that string later. (Think of someone using a computer localized for Russia trying to read a document written in Hebrew — internally, characters can be thought of as numbers in a lookup table, and with different languages and character sets, character #100 in either character set is likely to be different.)
A web browser or HTTP-enabled script.
A variable is what data bound to a name is called. The name "variable" usually refers to the basic types and not more complex objects. This is true even though integers, floats, imaginary numbers, and strings are all objects in Python. This way of thinking is a convention that carries over from other languages where the distinction is made.
A program that exposes its interface through HTTP instead of through a command-line or GUI interface.
A web application designed for use by HTTP-enabled scripts instead of human beings with web browsers.
IP port numbers between 0 and 1023 are well-known ports. Popular services like web servers tend to run on well-known ports, and services running on well-known ports often run with administrator privileges.
Whitespace refers to the names of the characters that you can't see when you are typing or reading. Newlines, spaces, and tab characters are all whitespace. Python pays attention to whitespaces at the beginnings of lines, and it is aware of newlines at the ends of lines, except inside list or tuple definitions, and except inside triple-quoted strings.
A web application that allows its users to create and edit web pages through a web interface.
Web Services Description Language, a way of representing method calls in XML.
eXtensible Markup Language. A specification for creating structured markup languages with customized vocabularies.
The RPC stands for Remote Procedure Call. XML-RPC is a standard for making web service calls. It defines a way of representing simple data structures in XML, sending data structures over HTTP as arguments to a function call, and getting another data structure back as a return value.
A specification for producing a Document Model.
The process of checking that an XML document is well formed and conforms to its document model.
The process of checking that an XML document conforms to the XML specification.
Xrange generates an xrange object, which is an iterable object that behaves similarly to a list, but because a list is not created there is no additional memory used when larger ranges of numbers are required.
Extensible Style Language Formatting Objects. Markup language for graphical display. Commonly used for producing documents for final presentation.
Extensible Style Language for Transformations. A programming language for transforming XML.
18.216.255.250