python -m doctest module_with_tests.py
Python Lingo
Many terms here are not exclusive to Python, but some common terms have definitions that are specific to the Python community.
Also see the official Python Glossary.
- ABC (programming language)
-
A programming language created by Leo Geurts, Lambert Meertens, and Steven Pemberton. Guido van Rossum, who developed Python, worked as a programmer implementing the ABC environment in the 1980s. Block structuring by indentation, built-in tuples and dictionaries, tuple unpacking, the semantics of the
for
loop, and uniform handling of all sequence types are some of the distinctive characteristics of Python that came from the ABC language. - Abstract base class (ABC)
-
A class that cannot be instantiated, only subclassed. ABCs are how interfaces are formalized in Python. Instead of inheriting from an ABC, a class may also declare that it fulfills the interface by registering with the ABC to become a virtual subclass.
- accessor
-
A method implemented to provide access to a single data attribute. Some authors use accessor as a generic term encompassing getter and setter methods, others use it to refer only to getters, referring to setters as mutators.
- alias
-
An alternative name for an object. For example, in
a = []; b = a
the variableb
is an alias to the list bound toa
. - aliasing
-
Binding two or more names to the same object. Aliasing happens naturally all the time in any language where variables and function parameters hold references to objects. To avoid confusion, just forget the idea that variables are boxes that store objects (an object can’t be in two boxes at the same time). It’s better to think of them as labels attached to objects (an object can have more than one label). See alias.
- argument
-
An expression passed to a function when it is called. In Pythonic parlance, argument and parameter are often used as synonyms. To be more specific, some authors write "actual argument" to contrast with "formal parameter". See parameter for more about the distinction and usage of these terms.
- attribute
-
Methods and data attributes (i.e., "fields" in Java terms) are all known as attributes in Python. A method is just an attribute that happens to be a callable object (usually a function, but not necessarily).
- BDFL
-
Benevolent Dictator For Life, alias for Guido van Rossum, creator of the Python language. Since PEP 13—Python Language Governance was adopted in December 2018, the powers of the BDFL are now in the hands of a Steering Council, and Guido is the "BDFL emeritus."
- binary sequence
-
Generic term for sequence types with byte elements. The built-in binary sequence types are
byte
,bytearray
, andmemoryview
. - BOM
-
Byte Order Mark, a sequence of bytes that may be present at the start of a UTF-16 encoded file. A BOM is the character U+FEFF (
ZERO WIDTH NO-BREAK SPACE
) encoded to produce eitherb'\xfe\xff'
on a big-endian CPU, orb'\xff\xfe'
on a little-endian one. Because there is no U+FFFE characer in Unicode, the presence of these bytes unambiguously reveals the byte ordering used in the encoding. Although redundant, a BOM encoded asb'\xef\xbb\xbf'
may be found in UTF-8 files saved by some Microsoft applications, and is also required by Excel when reading text files. To read or write such files with Python, use theUTF-8-SIG
codec. - bound method
-
A method that is accessed through an instance becomes bound to that instance. Any method is actually a descriptor. When accessed, a method returns itself wrapped in an object that binds the method to the receiver. That object is the bound method. It can be invoked without passing the value of
self
. For example, given the assignmentmy_method = my_obj.method
, the bound method can later be called asmy_method()
. Contrast with unbound method. See receiver. - built-in function (BIF)
-
A function bundled with the Python interpreter, coded in the implementation language of the interpreter (i.e., C for CPython; Java for Jython, and so on). The term often refers only to the functions that don’t need to be imported, documented in Chapter 2, "Built-in Functions," of The Python Standard Library Reference. However, built-in modules like
sys
,math
,re
, etc. also contain built-in functions. - byte string
-
An unfortunate name still used to refer to
bytes
orbytearray
in Python 3. In Python 2, thestr
type was really a byte string, and the term made sense to distinguishstr
fromunicode
strings. In Python 3, it makes no sense to insist on this term, and I tried to use byte sequence whenever I needed to talk in general about…byte sequences. - bytes-like object
-
A generic sequence of bytes. The most common bytes-like types are
bytes
,bytearray
, andmemoryview
but other objects supporting the low-level CPython buffer protocol also qualify, if their elements are single bytes.
- callable object
-
An object that can be invoked with the call operator
()
, to return a result or to perform some action. There are nine flavors of callable objects in Python: user-defined functions, built-in functions, built-in methods, instance methods, generator functions, asynchronous generator functions, coroutines, classes, and instances of classes that implement the__call__
special method. - CamelCase
-
The convention of writing identifiers by joining words with uppercased initials (e.g.,
ConnectionRefusedError
). PEP-8 recommends class names should be written in CamelCase, but the advice is not followed by the Python standard library. See snake_case. - Cheese Shop
-
Original name of the Python Package Index (PyPI), after the Monty Python skit about a cheese shop where nothing is available. As of this writing, the alias https://cheeseshop.python.org still works. See PyPI.
- class
-
A program construct defining a new type, with data attributes and methods specifying possible operations on them. See type.
- code point
-
An integer in the range 0 to 0x10FFFF used to identify an entry in the Unicode character database. As of Unicode 7.0, less than 3% of all code points are assigned to characters. In the Python documentation, the term may be spelled as one or two words. For example, in Chapter 2, "Built-in Functions," of the Python Library Reference, the
chr
function is said to take an integer "codepoint," while its inverse,ord
, is described as returning a "Unicode code point." - code smell
-
A coding pattern that suggests there may be something wrong with the design of a program. For example, excessive use of
isinstance
checks against concrete classes is a code smell, as it makes the program harder to extend to deal with new types in the future. - codec
-
(encoder/decoder) A module with functions to encode and decode, usually from
str
tobytes
and back, although Python has a few codecs that performbytes
tobytes
andstr
tostr
transformations. - collection
-
Generic term for data structures made of items that can be accessed individually. Some collections can contain objects of arbitrary types (see container) and others only objects of a single atomic type (see flat sequence).
list
andbytes
are both collections, butlist
is a container, andbytes
is a flat sequence. - considered harmful
-
Edsger Dijkstra’s letter titled "Go To Statement Considered Harmful" established a formula for titles of essays criticizing some computer science technique. Wikipedia’s "Considered harmful" article lists several examples, including "'Considered Harmful' Essays Considered Harmful" by Eric A. Meyer.
- constructor
-
Informally, the
__init__
instance method of a class is called its constructor, because its semantics is similar to that of a Java constructor. A better term for__init__
is initializer, as the method does not actually build the instance, but receives it as itsself
argument. The constructor term better describes the__new__
class method, which Python calls before__init__
, and is responsible for actually creating an instance and returning it. See initializer. - container
-
An object that holds references to other objects. Most collection types in Python are containers, but some are not. The term is defined in section 3.1. Objects, values and types of the Python Data Model documentation: "Some objects contain references to other objects; these are called containers. Examples of containers are tuples, lists and dictionaries." Contrast with flat sequence, which are collections but not containers. Also see Container (ABC) for a different definition.
- Container (ABC)
-
The Abstract base class (ABC) defined in
collections.abc.Container
, with a single method__contains__
which implements thein
operator. Thestr
andarray.array
types are virtual subclasses ofContainer
, but they are not containers in the other definition of container. - context manager
-
An object implementing both the
__enter__
and__exit__
special methods, for use in awith
block. - coroutine
-
A generator used for concurrent programming by receiving values from a scheduler or an event loop via
coro.send(value)
. The term may be used to describe the generator function or the generator object obtained by calling the generator function. See generator. - CPython
-
The standard Python interpreter, implemented in C. This term is only used when discussing implementation-specific behavior, or when talking about the multiple Python interpreters available, such as PyPy.
- CRUD
-
Acronym for Create, Read, Update, and Delete, the four basic functions in any application that stores records.
- decorator
-
A callable object
A
that returns another callable objectB
and is invoked in code using the syntax@A
right before the definition of a callableC
. When reading such code, the Python interpreter invokesA©
and binds the resultingB
to the variable previously assigned toC
, effectively replacing the definition ofC
withB
. If the target callableC
is a function, thenA
is a function decorator; ifC
is a class, thenA
is a class decorator. - deep copy
-
A copy of an object in which all the objects that are attributes of the object are themselves also copied. Contrast with shallow copy.
- descriptor
-
A class implementing one or more of the
__get__
,__set__
, or__delete__
special methods acts as a descriptor when one of its instances is used as a class attribute of another class, the managed class. A descriptor manages the access and deletion of a managed attribute in the managed instance. For example, in a Django model, the user’smodel.Model
subclass is the managed class, the fields are descriptors, and each record is a managed instance. - docstring
-
Short for documentation string. When the first statement in a module, class, or function is a string literal, it is taken to be the docstring for the enclosing object, and the interpreter saves it as the
__doc__
attribute of that object. See also doctest. - doctest
-
A module with functions to parse and run examples embedded in the docstrings of Python modules or in plain-text files. May also be used from the command line as:
- DRY
-
Don’t Repeat Yourself—a software engineering principle stating that "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system." It first appeared in the book The Pragmatic Programmer by Andy Hunt and Dave Thomas (Addison-Wesley, 1999).
- duck typing
-
A form of polymorphism where functions operate on any object that implements the appropriate methods, regardless of their classes or explicit interface declarations.
- dunder
-
Shortcut to pronounce the names of special methods and attributes that are written with leading and trailing double-underscores (i.e.,
__len__
is read as "dunder len"). - dunder method
-
See dunder and special method.
- EAFP
-
Acronym standing for the quote "It’s easier to ask forgiveness than permission," attributed to computer pioneer Grace Hopper, and quoted by Pythonistas referring to dynamic programming practices like accessing attributes without testing first if they exist, and then catching the exception when that is the case. The docstring for the
hasattr
function actually says that it works "by calling getattr(object, name) and catching AttributeError." - eager
-
An iterable object that builds all its items at once. In Python, a list comprehension is eager. Contrast with lazy.
- fail-fast
-
A systems design approach recommending that errors should be reported as early as possible. Python adheres to this principle more closely than most dynamic languages. For example, there is no "undefined" value: variables referenced before initialization generate an error, and
my_dict[k]
raises an exception ifk
is missing (in contrast with JavaScript). As another example, parallel assignment via tuple unpacking in Python only works if every item is explicitly handled, while Ruby silently deals with item count mismatches by ignoring unused items on the right side of the=
, or by assigningnil
to extra variables on the left side. - falsy
-
Any value
x
for whichbool(x)
returnsFalse
; Python implicitly callsbool(…)
to evaluate objects in Boolean contexts, such as the expression controlling anif
orwhile
loop. Thebool
function considers falsy:False
,None
, any number equal to zero, any sequence or collection with length zero, any object with a__bool__
method that returnsFalse
. By convention, all other objects are truthy. - file-like object
-
Used informally in the official documentation to refer to objects implementing the file protocol, with methods such as
read
,write
,close
, etc. Common variants are text files containing encoded strings with line-oriented reading and writing,StringIO
instances which are in-memory text files, and binary files, containing unencoded bytes. The latter may be buffered or unbuffered. ABCs for the standard file types are defined in theio
module since Python 2.6. - first-class function
-
Any function that is a first-class object in the language (i.e., can be created at runtime, assigned to variables, passed as an argument, and returned as the result of another function). Python functions are first-class functions.
- flat sequence
-
A sequence type that physically stores the values of its items, and not references to other objects. The built-in types
str
,bytes
,bytearray
,memoryview
, andarray.array
are flat sequences. Contrast withlist
,tuple
, andcollections.deque
, which are container sequences. See container. - function
-
Strictly, an object resulting from evaluation of a def block or a lambda expression. Informally, the word function is used to describe any callable object, such as methods and even classes sometimes. The official Built-in Functions list includes several built-in classes like
dict
,range
, andstr
. Also see callable object.
- genexp
-
Short for generator expression.
- generator
-
An iterator built with a generator function or a generator expression that may produce values without necessarily iterating over a collection; the canonical example is a generator to produce the Fibonacci series which, because it is infinite, would never fit in a collection. The term is sometimes used to describe a generator function, besides the object that results from calling it.
- generator function
-
A function that has the
yield
keyword in its body. When invoked, a generator function returns a generator. - generator expression
-
An expression enclosed in parentheses using the same syntax of a list comprehension, but returning a generator instead of a list. A generator expression can be understood as a lazy version of a list comprehension. See lazy.
- generic function
-
A group of functions designed to implement the same operation in customized ways for different object types. As of Python 3.4, the
functools.singledispatch
decorator is the standard way to create generic functions. This is known as multimethods in other languages. - GoF book
-
Alias for Design Patterns: Elements of Reusable Object-Oriented Software (Addison-Wesley, 1995), authored by the so-called Gang of Four (GoF): Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides.
- hashable
-
An object is hashable if it has both
__hash__
and__eq__
methods, with the constraints that the hash value must never change and ifa == b
thenhash(a) == hash(b)
must also beTrue
. Most immutable built-in types are hashable, but a tuple is only hashable if every one of its items is also hashable. - higher-order function
-
A function that takes another function as argument, like
sorted
,map
, andfilter
, or a function that returns a function as result, as Python decorators do.
- idiom
-
"A manner of speaking that is natural to native speakers of a language," according to the Princeton WordNet.
- import time
-
The moment of initial execution of a module when its code is loaded by the Python interpreter, evaluated from top to bottom, and compiled into bytecode. This is when classes and functions are defined and become live objects. This is also when decorators are executed.
- initializer
-
A better name for the
__init__
method (instead of constructor). Initializing the instance received asself
is the task of__init__
. Actual instance construction is done by the__new__
method. See constructor. - iterable
-
Any object from which the
iter
built-in function can obtain an iterator. An iterable object works as the source of items in for loops, comprehensions, and tuple unpacking. Objects implementing an__iter__
method returning an iterator are iterable. Sequences are always iterable; other objects implementing a__getitem__
method may also be iterable. - iterable unpacking
-
A modern, more precise synonym for tuple unpacking. See also parallel assignment.
- iterator
-
Any object that implements the
__next__
no-argument method, which returns the next item in a series, or raisesStopIteration
when there are no more items. Python iterators also implement the__iter__
method so they are also iterable. Classic iterators, according to the original design pattern, return items from a collection. A generator is also an iterator, but it’s more flexible. See generator.
- KISS principle
-
The acronym stands for "Keep It Simple, Stupid." This calls for seeking the simplest possible solution, with the fewest moving parts. The phrase was coined by Kelly Johnson, a highly accomplished aerospace engineer who worked in the real Area 51 designing some of the most advanced aircraft of the 20th century.
- lazy
-
An iterable object that produces items on demand. In Python, generators are lazy. Contrast eager.
- listcomp
-
Short for list comprehension.
- list comprehension
-
An expression enclosed in brackets that uses the
for
andin
keywords to build a list by processing and filtering the elements from one or more iterables. A list comprehension works eagerly. See eager. - liveness
-
An asynchronous, threaded, or distributed system exhibits the liveness property when "something good eventually happens" (i.e., even if some expected computation is not happening right now, it will be completed eventually). If a system deadlocks, it has lost its liveness.
- magic method
-
Same as special method.
- managed attribute
-
A public attribute managed by a descriptor object. Although the managed attribute is defined in the managed class, it operates like an instance attribute (i.e., it usually has a value per instance, held in a storage attribute). See descriptor.
- managed class
-
A class that uses a descriptor object to manage one of its attributes. See descriptor.
- managed instance
-
An instance of a managed class. See descriptor.
- metaclass
-
A class whose instances are classes. By default, Python classes are instances of
type
, for example,type(int)
is the classtype
, thereforetype
is a metaclass. User-defined metaclasses can be created by subclassingtype
. - metaprogramming
-
The practice of writing programs that use runtime information about themselves to change their behavior. For example, an ORM may introspect model class declarations to determine how to validate database record fields and convert database types to Python types.
- monkey patching
-
Dynamically changing a module, class, or function at runtime, usually to add features or fix bugs. Because it is done in memory and not by changing the source code, a monkey patch only affects the currently running instance of the program. Monkey patches break encapsulation and tend to be tightly coupled to the implementation details of the patched code units, so they are seen as temporary workarounds and not a recommended technique for code integration.
- mixin class
-
A class designed to be subclassed together with one or more additional classes in a multiple-inheritance class tree. A mixin class should never be instantiated, and a concrete subclass of a mixin class should also subclass another nonmixin class.
- mixin method
-
A concrete method implementation provided in an ABC or in a mixin class.
- mutator
-
See accessor.
- name mangling
-
The automatic renaming of private attributes from
__x
to_MyClass__x
, performed by Python at runtime. - nonoverriding descriptor
-
A descriptor that does not implement
__set__
and therefore does not interfere with setting of the managed attribute in the managed instance. Consequently, if a namesake attribute is set in the managed instance, it will shadow the descriptor in that instance. Also called nondata descriptor or shadowable descriptor. Contrast with overriding descriptor.
- ORM
-
Object-Relational Mapper—an API that provides access to database tables and records as Python classes and objects, providing method calls to perform database operations. SQLAlchemy is a popular standalone Python ORM; the Django and Web2py frameworks have their own bundled ORMs.
- overriding descriptor
-
A descriptor that implements
__set__
and therefore intercepts and overrides attempts at setting the managed attribute in the managed instance. Also called data descriptor or enforced descriptor. Contrast with [non-overriding_descriptor].
- parallel assignment
-
Assigning to several variables from items in an iterable, using syntax like a, b = [c, d]—also known as destructuring assignment. This is a common application of tuple unpacking.
- parameter
-
Functions are declared with 0 or more "formal parameters," which are unbound local variables. When the function is called, the arguments or "actual arguments" passed are bound to those variables. In Fluent Python, I tried to use argument to refer to an actual argument passed to a function, and parameter for a formal parameter in the function declaration. However, that is not always feasible because the terms parameter and argument are used interchangeably throughout the Python documentation and API. See argument.
- prime (verb)
-
Calling
next(coro)
on a coroutine to advance it to its firstyield
expression so that it becomes ready to receive values in succeedingcoro.send(value)
calls. - PyPI
-
The Python Package Index, where more than 60,000 packages are available, also known as the ). PyPI is pronounced as "pie-P-eye" to avoid confusion with PyPy.
- PyPy
-
An alternative implementation of the Python programming language using a toolchain that compiles a subset of Python to machine code, so the interpreter source code is actually written in Python. PyPy also includes a JIT to generate machine code for user programs on the fly—like the Java VM does. As of November 2014, PyPy is 6.8 times faster than CPython on average, according to published benchmarks. PyPy is pronounced as "pie-pie" to avoid confusion with PyPI.
- Pythonic
-
Used to praise idiomatic Python code, that makes good use of language features to be concise, readable, and often faster as well. Also said of APIs that enable coding in a way that seems natural to proficient Python programmers. See idiom.
- receiver
-
The object to which a method call is applied; e.g. the
x
inx.play()
. The first parameter of the method (conventionally namedself
) is bound to the receiver. See bound method. - refcount
-
The reference counter that each CPython object keeps internally in order to determine when it can be destroyed by the garbage collector. See strong reference and weak reference.
- referent
-
The object that is the target of a reference. This term is most often used to describe the target of a weak reference.
- REPL (Read-eval-print loop)
-
An interactive console, like the standard
python
prompt>>>
or alternatives likeipython
,bpython
, and Python Anywhere.
- sequence
-
Generic name for any iterable data structure with a known size (e.g.,
len(s)
) and allowing item access via 0-based integer indexes (e.g.,s[0]
). The word sequence has been part of the Python jargon from the start, but only in Python 2.6 it was formalized as an ABC incollections.abc.Sequence
. - serialization
-
Converting an object from its in-memory structure to a binary or text-oriented format for storage or transmission, in a way that allows the future reconstruction of a clone of the object on the same system or on a different one. The
pickle
module supports serialization of arbitrary Python objects to a binary format. - shallow copy
-
A copy of an object which shares references to all the objects that are attributes of the original object. Contrast with deep copy. Also see aliasing.
- singleton
-
An object that is the only existing instance of a class—usually not by accident but because the class is designed to prevent creation of more than one instance. There is also a design pattern named Singleton, which is a recipe for coding such classes. The
None
object is a singleton in Python. - slicing
-
Producing a subset of a sequence by using the slice notation, e.g.,
my_sequence[2:6]
. Slicing usually copies data to produce a new object; in particular,my_sequence[:]
creates a shallow copy of the entire sequence. But amemoryview
object can be sliced to produce a newmemoryview
that shares data with the original object. - snake_case
-
The convention of writing identifiers by joining words with the underscore character (
_
)—for example,run_until_complete
. PEP-8 calls this style "lowercase with words separated by underscores" and recommends it for naming functions, methods, arguments, and variables. For packages, PEP-8 recommends concatenating words with no separators. The Python standard library has many examples ofsnake_case
identifiers, but also many examples of identifiers with no separation between words (e.g.,getattr
,classmethod
,isinstance
,str.endswith
, etc.). See CamelCase. - special method
-
A method with a special name such as
__getitem__
, spelled with leading and trailing double underscores. Almost all special methods recognized by Python are described in the "Data model" chapter of The Python Language Reference, but a few that are used only in specific contexts are documented in other parts of the documentation. For example, the__missing__
method of mappings is mentioned in "4.10. Mapping Types — `dict`" in The Python Standard Library. - storage attribute
-
An attribute in a managed instance used to store the value of an attribute managed by a descriptor. See also managed attribute.
- strong reference
-
A reference that is counted in an object’s refcount, and keeps that object alive in memory. Contrast with weak reference.
- subject
-
The value of the expression in the
match
clause. Python will try to match the pattern in eachcase
clause to the subject.
- tuple unpacking
-
Assigning items from an iterable object to a tuple of variables (e.g.,
first, second, third == my_list
). This is the usual term used by Pythonistas, but iterable unpacking is gaining traction. - truthy
-
Any value
x
for whichbool(x)
returnsTrue
; Python implicitly usesbool
to evaluate objects in Boolean contexts, such as the expression controlling anif
orwhile
loop. By default, a Python object is truthy unless their__bool__
method returnsFalse
. See the short list of conventional falsy objects. - type
-
Each specific category of program data, defined by a set of possible values and operations on them. Some Python types are close to machine data types (e.g.,
float
andbytes
) while others are extensions (e.g.,int
is not limited to CPU word size,str
holds multibyte Unicode data points) and more high-level abstractions (e.g.,dict
,deque
, etc.). Types may be user defined or built into the interpreter (a "built-in" type). Before the type/class unification in Python 2.2, types and classes were different entities, and user-defined classes could not extend built-in types. Since then, built-in types and new-style classes became compatible. Every new-style class is a subclass of theobject
class and an instance of thetype
built-in metaclass. In Python 3 all classes new-style classes.
- unbound method
-
An instance method accessed directly on a class is not bound to an instance; therefore it’s said to be an "unbound method." To succeed, a call to an unbound method must explicitly pass an instance of the class as the first argument. That instance will be assigned to the
self
argument in the method. See bound method. - uniform access principle
-
Bertrand Meyer, creator of the Eiffel Language, wrote: "All services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation." Properties and descriptors allow the implementation of the uniform access principle in Python. The lack of a
new
operator, making function calls and object instantiation look the same, is another form of this principle: the caller does not need to know whether the invoked object is a class, a function, or any other callable. - user-defined
-
Almost always in the Python docs the word user refers to you and I—programmers who use the Python language—as opposed to the developers who implement a Python interpreter. So the term "user-defined class" means a class written in Python, as opposed to built-in classes written in C, like
str
.
- view
-
Python 3 views are special data structures returned by the
dict
methods.keys()
,.values()
, and.items()
, providing a dynamic view into thedict
keys and values without data duplication (which occurs in Python 2 where those methods return lists). Alldict
views are iterable and support thein
operator. In addition, if the items referenced by the view are all hashable, then the view also implements thecollections.abc.Set
interface. This is the case for all views returned by the.keys()
method, and for views returned by.items()
when the values are also hashable. - virtual subclass
-
A class that does not inherit from an ABC but is registered using the
register
class method. For example, afterabc.Sequence.register(MySequence)
, the callissubclass(MySequence, abc.Sequence)
returnsTrue
. See documentation forabc.ABCMeta.register
.
- walrus operator
-
Semi-official name for the := operator, formally described in PEP 572—Assignment Expressions. Turn your head 90° to the left and think of a walrus to understand why.
- wart
-
A misfeature of the language. Andrew Kuchling’s famous post Python warts has been acknowledged by the BDFL as influential in the decision to break backward-compatibility in the design of Python 3, as most of the failings could not be fixed otherwise. Many of Kuchling’s issues were fixed in Python 3. See Python Warts in wiki.python.org.
- weak reference
-
A special kind of object reference that does not increase the refcount of the referent object. Weak references are created with one of the functions and data structures in the
weakref
module. Contrast with strong reference.