( ) (parentheses)
for tuples, 15
* (star)
in function arguments, 102–104, 108–109
in module imports, 229–230, 240–241
in variable names, 46
operator, 5, 38–40, 47, 57, 298, 307, 310, 313
** (double star)
in function arguments, 104, 108–109
+ (plus sign)
in file modes, 258
in numbers converted to text strings, 250–251
operator, 5, 10–11, 14, 38–40, 47, 57, 91, 298, 307, 310, 313
, (comma)
in numbers converted to text strings, 250–251
separating values, 276
- (minus sign)
in byte formatting, 253
in numbers converted to text strings, 250–251
operator, 5, 18, 39–40, 50, 57, 309
.. (double dots), in relative imports, 237
... (ellipsis), in extended slices, 96
/ (slash)
as path separator, 281
in function signature, 105
: (colon)
for dictionaries, 18
for slicing operator, 10, 47–49
:= operator, 8, 12, 39, 54, 57
testing for None with, 87
[] (square brackets), 13
# comments, 2
% (percent sign)
in byte formatting, 253
in numbers converted to text strings, 251
operator, 5, 9, 39–40, 57, 298, 310
&, ^ operators, 6, 18, 40, 50, 57, 309
_ (undescore)
in function names, 106
in names of internal variables, 27
in numeric literals, 38
in private attribute and method names, 176
__ (double undescore)
\ (backslash), as path separator, 281
| operator, 6, 18, 40, 50, 57, 302, 309
>=, <= operators, 6, 42, 57, 93
>>> prompt, 1
{ } (curly braces), 20
for dictionaries, 18
in f-strings, 252
ABC base class, 185
abc module, 185
__abs__() method, 91
@abstractmethod decorator, 130, 185
__abstractmethods__ attribute, 222
__add__() method, 27, 80, 90–91
addition, 5
__aenter__(), __aexit__() methods, 136
__aiter__(), __anext__() methods, 137
__all__ variable, 229, 240–241
__and__() method, 90
annotations, 23
__annotations__ attribute, 107, 129, 222, 242
append() method, 13, 26, 300, 307, 313
applicative evaluation order, 101
archives, working with, 284
arguments, see functions, arguments of
ArithmeticError exception, 67–68, 314–318
as qualifier, 31, 64, 75, 99, 226
as_integer_ratio() method, 303
asctime() function, 293
AssertionError exception, 68, 77, 315
assignment expression operator, see := operator
async for, async with statements, 137
asyncio module, 135, 137, 151, 271–274, 285
atexit module, 26
AttributeError exception, 68, 98, 207, 304, 315
deleting, 301
fully qualified, 158
lazy evaluation of, 214
no type contraints on, 179
of classes, 308
public, 176
awaitables, 135
banker’s rounding, 5
base classes, 160
invoking menthods of, 313
linking to, 207
__slots__ variable and, 210
tuple of, 222
used for type hinting, 184–185
base64 module, 274
BaseException exception, 67–68, 314
bash shell, 1
binary data structures, 288
binary integers, 6
binascii module, 274
bit manipulation, 6
bit_length() method, 305
BlockingIOError exception, 270, 316
bool class, 297
bool type, 298
Boolean values, 6–7, 38, 43–44, 297
break statement, 8, 12, 62–63, 141
breakpoint() function, 298
BrokenPipeError exception, 316
BSD socket interface, 286
BufferedXXX classes, 260
BufferError exception, 315
byte arrays, 247, 266, 298–300
comparing, 43
converting to text, 274
serializing objects into, 268
bytes module, 274
BytesIO class, 280
C programming language, 281, 286, 288
callable() function, 301
returning results from, 121–123
CallbackError exception, 122
casefold() method, 310
category() function, 295
__cause__ attribute, 65, 71–73, 315
__ceil__() method, 91
cgi module, 275
characters
line-feed, see newline characters
ordinal values of, 307
check_output() function, 288–289
child classes, see subclasses
ChildProcessError exception, 316
chr() function, 301
circular dependency, 82
class methods, 89, 170–172, 222, 301
class statement, 27, 154–155, 215–218
base-class names in, 160
mutating, 112
adding methods to, 28
body of, 215
built-in, 313
duplicating definitions of, 221
extending, 160
inspecting, 318
internal variables in, 27
linking instances to, 206, 223
membership testing for, 183
names of, 222
static methods in, 173
type-checking, 162
uniformity of, 183
with a single method, 166
classmethod object, 125
@classmethod decorator, 125, 170–171, 183, 197, 213, 301
classobj type, 305
click module, 255
close() method, 12, 147, 202, 258, 262, 315
closed attribute, 263
__closure__ attribute, 129
cls object, 125, 171, 220, 222
code, see also programs
testing, 223
collect() function, 82
collections module, 20, 81, 168, 240, 318
comma-separated values (CSVs), 276
command-line options, 15, 33, 254–255, 317, 319
comments, 2
extracting, 55
between bytes and text, 248
compile() function, 301
complex() function, 301
__complex__() method, 94–95, 301
compound-interest calculation, 4
compute_usage() function, 282–283
concatenation, 47
of tuples, 16
concurrency, 148, 269, 273, 291–293
conditionals, 4, 7–9, 44–45, 59–60
configparser module, 276
ConnectionXXXError exceptions, 316
cleaning up with, 141
__context__ attribute, 65, 72–73, 315
@contextmanager decorator, 148
control flow
coroutines, 135
generator-based, 146
inspecting, 318
cos() function, 318
count() method, 298, 307, 310, 313
Counter class, 318
cryptographic hash values, 278
ctime() function, 293
currentframe() function, 132
daemon flag, 291
data encapsulation, 176
data hiding, 178
@dataclass decorator, 134
debug variable, 215
debugging
breakpoint for, 298
exception handling and, 74
in Python development environment, 3
logging for, 280
making output for, 162
modules individually, 235
smaller tasks, 145
stack frames and, 133
when using dictionaries, 21
with __dict__ attribute, 211
with repr(), 11
decode() method, 248, 259, 298, 310
decorators, 104, 124–127, 194–197, 220
deep copies, 83
deepcopy() function, 84
DEFAULT_BUFFER_SIZE value, 259
defaultdict class, 318
del statement, 19, 50–51, 82–83, 89, 202, 207, 300–302, 307
delattr() function, 157, 179, 301
__delete__() method, 211
dependency injection, 165, 176
descriptors, 211–214, 220, 285
Design Patterns book, 176
detach() method, 261
__dict__ attribute, 206–207, 211, 215, 222–223, 242, 302, 313
accessing members of, 18
adding unusual items to, 85–87
as literals, 38
assignments on, 83
converting to lists, 20
deep vs. shallow copies of, 83
dispatching through, 193
initializing missing items automatically, 318
inserting objects into, 18
iterating over, 21
modifying objects of, 18
nested, 19
no ordered comparisons on, 43
number of items in, 306
passed as function parameters, 107
removing elements from, 19, 104
using tuples in, 19
values of, 21
dictionary comprehension, 20, 53–54
dictionary lookups, 176
DictReader class, 277
difference operation, 18, 50, 309
difference() method, 309
difference_update() method, 309
__dir__() method, 302
directories, 264
current working, 234
temporary, 289
distutils module, 243
__divmod__() method, 90
Django library, 279
__doc__ attribute, 106, 129, 222, 242
docopt module, 255
documentation strings, 106, 129, 155, 222, 242
dot operator, see . operator
double-ended queues, 318
duck typing, 167
dump() function, 268
dumps() function, 280
dynamic binding, 167
e, E, in numbers, 37
echo servers, 286
.egg suffix, 234
elif statement, 7–8, 59–60, 193
Ellipsis object, 96
else statement, 7–9, 44–45, 57, 59–60, 63, 66, 193
emails, sending, 285
encode() method, 248, 259, 310
encoding attribute, 13, 259–260, 263
endswith() method, 10, 298, 311
__enter__() method, 75, 99, 148
env command, 256
environment variables, 256
EnvironmentError exception, 314–316
EOF (end of file) character, 2, 68, 315
epoll() function, 285
errno attribute, 316
errors
logging, 66
errors attribute, 259–260, 263
eval() function, 89, 301, 303, 308
Event class, 292
except statement, 24–25, 64–66, 70, 110
narrowness of, 74
Exception exception, 66–69, 314
asynchronous, 69
expected vs. unexpected, 72–73
extracting values attached to, 141
handling, 24–25, 73–75, 110–111, 121–122, 277–278
propagating, 64
raising, 64, 69, 110, 147, 315
wrapping with a function, 54
exec() function, 133–134, 233, 301, 303
__exit__() method, 75, 99, 148
Extensible Markup Language (XML), 295
False value, 6–7, 38, 43–45, 297–298
fast lookups, 19
fcntl() function, 278
attributes of, 263
implementing, 279
manipulating, 261
methods supported by, 261
standard, 263
file pointers, 262
__file__ variable, 241
FileExistsError exception, 258, 316
FileIO class, 260
fileno() method, 262
FileNotFoundError exception, 277, 316
files
converting between binary and text, 261
locking, 278
metadata of, 282
newline characters in, 260, 263
overwritting, 258
parsing, 105
state of, 263
temporary, 289
finally statement, 25, 66, 141
first-class objects, 85–87, 115, 242
flag variables, 63
flask library, 279
float() function, 11, 303, 315
__float__() method, 94–95, 303
FloatingPointError exception, 67, 314–315
precision of, 288
flock() function, 278
__floor__() method, 91
__floordiv__() method, 90
flyweight pattern, 176
for statement, 12–13, 21–22, 45, 60–63, 140, 176
for reading lines in a file, 262
implementing, 97
on lists, 52
format() function, 11, 94, 250, 304
format() method, 9, 252–253, 311
format_map() method, 311
from statement, 31, 228–230, 237, 316
from_ prefix, in method names, 172
from_bytes() method, 305
fromkeys() method, 302
frozenset() function, 304, 309
__fspath__() method, 257
function call operator, 56
functions, 22–24, 101–131, 137
accepting iterables, 47
arguments of
evaluated left-to-right, 101
order of, 101
asynchronous, 135–137, 272, 317
attribute access, 207
comparing, 131
debugging messages in, 124
delayed execution of, 145
emulating, 98
evaluating, 116
helper, 106
local variables in, 24, 107, 111–113, 149–151
recursive, 114
side effects in, 108
wrappers around, 124
functools module, 94
futures, 123
garbage collection, 26, 81–83, 89, 141, 203–204
gc module, 82
__ge__() method, 93
generator expressions, 54–56, 128
GeneratorExit exception, 147, 314–315
asynchronous, 317
creating, 54
for repeated iterations, 142
inspecting, 318
terminating, 315
get_data() function, 242
getattr() function, 157, 179, 193–194, 304
__getattr__() method, 98, 207–211
__getattribute__() method, 98, 207, 211
__getitem__() method, 95–96, 159–308
getsize() function, 282
__getstate__() method, 268
glob() function, 264
global statement, 112
globals() function, 131, 303–304
__globals__ attribute, 129, 131
globbing, 264
gmtime() function, 293
__gt__() method, 93
hasattr() function, 157, 179, 304
hash() function, 304
hashlib module, 278
help() command, 22
higher-order functions, 115–118
http package, 279
HyperText Markup Language (HTML), 279
Hypertext Transfer Protocol (HTTP), 279, 293–294
__iadd__(), __iand__() methods, 91–92
identifiers, 38
identity checks, 92
if statement, 7–9, 39, 44–45, 52, 57, 59–60, 193
__ifloordiv__(), __ilshift__(), __imatmul__(), __imod__() methods, 91–92
import statement, 15, 30–35, 59, 225–237, 241, 245, 316
ImportError exception, 31, 67–68, 226, 237, 316
importlib library, 232
in operator, 19, 45, 50–52, 57, 96, 302
in-place assignment, see assignments, augmented
indent() function, 290
IndentationError exception, 316
index() method, 299, 307, 311, 313
IndexError exception, 48, 49, 67, 314, 316
indexing operator, 13
on dictionaries, 18
on tuples, 16
info() function, 281
breaking code with, 162
propagating metaclasses via, 220
__slots__ variable and, 210
INI files, 276
__init__() method, 27, 70, 89, 134, 154–155, 161, 181–201, 219–220
__init__.py file, 34–35, 235–237, 239–241
__init_subclass__() method, 197–199, 220–222
input() function, 13, 33, 304, 315
error handling, 249, 256, 259, 316
nonblocking, 270
polling channels of, 271, 273, 284
insert() method, 13, 26, 300, 307
inspect module, 318
adding attributes to, 161, 206
alternate constructors of, 170–172
deleting an attribute of, 156
getting, 156
initializing, 89
setting, 156
state associated with, 206, 223
int class, 80
as literals, 37
base of, 37
binary, 6
converting
to text, 251
to/from bytes, 305
creating strings from
iterating over, 21
precision of, 316
testing values of, 303
InterruptedError exception, 316
intersection operation, 18, 50, 309
intersection() method, 309
__invert__() method, 91
ioctl() function, 278
IOError exception, 316
__ior__(), __ipow__() methods, 91–92
ipython shell, 2
__irshift__() method, 91–92 “is a” relationship, 163
is_integer() method, 303
IsADirectoryError exception, 316
isalnum(), isalpha() methods, 299, 311
isascii() method, 311
isatty() method, 262
isdecimal() method, 311
isdir() function, 282
isdisjoint() method, 309
isfile() function, 282
isidentifier() method, 311
isinstance() function, 64, 81, 183, 305
isnumeric(), isprintable() methods, 311
issubclass() function, 184, 305
issubset(), issuperset() methods, 309
iter() function, 305
__iter__() method, 97–98, 142, 152, 160, 305
iterations, 21–22, 45–47, 60–62, 97–98, 305
ending, 69
nested, 143
producing values for, 139
repeated, 142
reversed, 308
iterator objects
internal stack of, 146
reversed, 97
itertools module, 318
join() function, 281
JSON format, 280
json module, 280
KeyboardInterrupt exception, 67, 69, 314, 316
KeyError exception, 67, 314, 316
kqueue() function, 285
lambda expression, 114–115, 117–118
late binding, 115
__le__() method, 93
left-fold operations, 128
len() function, 10, 47, 50, 51, 159, 298, 302, 306, 309–310, 313
__len__() method, 28, 93, 95, 159–160, 308
libraries, 235
line endings, see newline characters
lineno attribute, 317
list comprehension, 17, 52, 55
filtering with, 127
list() function, 20, 47, 55, 81, 168, 306
listdir() function, 264
as sequences, 47
assignments on, 83
comparing, 42
concatenating, 14
converting to, from data, 14
creating, 13
deep vs. shallow copies of, 83, 306
defining subtypes of, 81
passed as function parameters, 107
removing items from, 307
slicing, 14
load() function, 268
loads() function, 280
locals() function, 131, 303, 307
localtime() function, 293
Lock class, 291
locks, 25
logical operators, 6–7, 43, 57, 92
LookupError exception, 67–68, 314, 316
aborting, 141
flag variables in, 63
numerical indices in, 61
skipping the reminder of, 8, 62
taking items from different sequences, 62
loose coupling, 167
__lshift__() method, 90
__main__ module, 234
__main__.py file, 235, 239, 245
math module, 318
mathematical operations, 5, 40, 90–92
__matmul__() method, 90
max() function, 47, 94, 128, 307
MD5 algorithm, 278
memory
allocating, 82
reducing usage of, 55, 210–211
MemoryError exception, 68, 316
Method Resolution Order (MRO, 190–192, 222
available on an object, 26
decorating automatically, 222
defining, 215
fully qualified, 158
implementing, 213
internal, 176
internal variables in, 27
invoking, 154
public, 176
rewriting, 195
user-defined, 180
Microsoft Excel, 276
min() function, 47, 94, 128, 307
__mod__() method, 90
mode attribute, 263
module objects, 226
__module__ attribute, 129, 222
__module__ variable, 215
ModuleNotFoundError exception, 316
as first-class objects, 242–243
compiling, 233
debugging, 235
importing, 31, 225–227, 232–234
specific definitions from, 228–230
listing contents of, 31
locating, 226
organizing, 33
reloading and unloading, 232–233
renaming, 227
standard library, 31, 273–296, 318–319
third-party, 32
monads, 123
__mro__ attribute, 190, 207, 222
multiplication, 5
name attribute, 263
__name__ attribute, 106, 129, 222, 242
named fields, 19
namedtuple() function, 134
NameError exception, 68, 111, 316–317
namespace packages, 237
global, 112
local, 111
__ne__() method, 93
__neg__() method, 91
network programs, 286, 288, 291
__new__() method, 89, 199–201, 219
newline attribute, 260
newline characters, 260, 263, 301, 304
controlling, in output, 265
in input, 266
newlines attribute, 263
next() method, 317
__next__() method, 97, 140, 152
None value, 6, 43–44, 87, 102, 108–110
normalize() function, 295
NotADirectoryError exception, 316
NotImplementedError exception, 68, 93, 316
numbers
comparing, 42
converting
from strings, 11
floating-point, 5, 37–38, 250–251, 288, 303, 308, 315
nonempty, 43
precision of, 251
random, 319
sum of, 312
numpy package, 50, 88, 96, 263
attributes of, 56
checking against classes, 183
converting to built-in types, 94–95
coroutine, 135
deep vs. shallow copies of, 83
immutable, 102
implementing operators for, 79
initializing, 27
invoked likes functions, 98
iterable, 45
listing available methods of, 26
methods available on, 26
representations of, 84–85, 297, 308
sorting, 94
state of, 154
unpacking values of, 45–46, 60
offset attribute, 317
open() function, 12, 15, 241, 256–261, 279, 307
operating-system functions, 281, 316, 319
implementing, 79
__or__() method, 90
ord() function, 307
os._exit() method, 317
os.chdir(), os.getcwd() methods, 257
os.environ variable, 256
os.system() function, 284
OSError exception, 64–65, 67–68, 277, 314, 316–318
output, see input/output (I/O)
OverflowError exception, 67, 314, 316
__package__ attribute, 242
importing files within, 34
imports within, 237
locating, 36
naming, 243
submodules of, running as scripts, 238–239
third-party, 50
pandas library, 277
parameters, see functions, arguments of
parent classes, see base classes
partial() function, 98
Path class, 282
path separators, 281
__path__ attribute, 242
pathlib module, 257, 264, 281–283
patterns, 176
performance, 55
exception handling and, 111
type checks and, 81
PermissionError exception, 277, 316
poll() function, 285
pop() method, 27, 104, 300, 302, 307, 309
Popen class, 289
popitem() method, 302
__pos__() method, 91
POSIX standard, 281
__pow__() method, 90
__prepare__() method, 219
primitive types, 3
print() function, 4, 11–13, 84, 265, 308
ProcessLookupError exception, 316
programs, see also code
side effects in, 108
specifying interpreter in, 3
starting from packages, 244
functions associated with, 207, 211
implementing, 211
@property decorator, 180–182, 308
push() method, 27
.py suffix, 2, 3, 30, 226, 233
__pycache__ directory, 233
pytest library, 319
Python
applying design patterns to, 176
flexibility of, 86
no internal variables in, 27
optimized mode of, 77
package index of, 243
runtime environment of, 254, 319
python shell, 1
PYTHONPATH environment variable, 234
__qualname__ attribute, 129, 222
__qualname__ variable, 215
Queue class, 292
quit(), in REPL, 2
__rand__() method, 91
random module, 319
raw_input() function, 315
__rdivmod__() method, 90
read() function, 258
read-evaluation-print loop (REPL), 1
readable() method, 262
readlines() method, 262
recursion, 114
RecursionError exception, 317
reduce() function, 128
reference counting, 81–83, 201
reference cycle, 203
ReferenceError exception, 317
regular expressions, 283–284, 319
reload() function, 232
remote servers, 208
remove() method, 18, 50, 300, 307, 309
removeprefix() method, 299, 312
removesuffix() method, 299, 312
replace() method, 10, 299, 312
repr() function, 11, 85, 89, 252, 308
__repr__() method, 28, 89–90, 154–155, 159–199
default implementation of, 160
resources, controlling, 99
return statement, 59, 109, 135, 140
__reversed__() method, 97, 308
__rfloordiv__() method, 90
rglob() function, 264
rindex(), rjust() methods, 299, 312
__rlshift__() method, 91
__rmatmul__(), __rmod__(), __rmul__()
methods, 90
__ror__(), __round__() methods, 91
rpartition(), rsplit() methods, 299, 312
__rpow__() method, 90
__rrshift__() method, 91
__rshift__() method, 90
__rsub__(), __rtruediv__() methods, 90
RuntimeError exception, 68, 114, 316–317
__rxor__() method, 91
sandbox, 36
seek(), seekable() methods, 262
select() function, 285
self object, 27, 154, 158, 169, 220
send() method, 152
sequences
comparing, 43
set() function, 17–18, 20, 47, 309
__set__() method, 211
__set_name__() method, 212
setattr() function, 157, 179, 310
__setattr__() method, 98, 207, 211
setdefault() method, 302
__setitem__() method, 95–96, 167
adding/removing items to/from, 50, 309
empty, 18
immutable, 304
number of items in, 50, 306, 309
order of elements in, 17
__setstate__() method, 268
setup() function, 244
setup.py file, 244
setuptools module, 234, 243–244
SHA-1 algorithm, 278
shallow copies, 83
short-circuit evaluation, 43
side effects, 108
SIGINT signal, 69
signal module, 69
__signature__ attribute, 131
Simple Mail Transfer Protocol (SMTP), 285
sin() function, 318
site-packages directory, 35, 244
sleep() function, 293
slice instance, 96
slice() function, 310
slicing operator, 10, 47–49, 298, 307, 310, 313
implementing, 96
on lists, 14
on tuples, 16
__slots__ variable, 210–211, 220–221, 223
sorted() function, 47, 114, 310
splatting, 46
split() function, 281
sprintf() function (C), 253
stack traceback objects, 65, 73
standard error, 263
standard input/output, 263, 304
start keyword, 62
startswith() method, 10, 300, 312
state machines, 176
statements, 59
executing, 303
@staticmethod decorator, 125, 173, 183, 213, 310
stdin, stdout attributes, 289
StopAsyncIteration exception, 317
StopIteration exception, 67, 69, 97, 140–141, 147, 307, 317
str() function, 11, 84, 94, 168, 248, 251–252, 310
__str__() method, 94, 171, 310
default implementation of, 160
strategy pattern, 176
strerror attribute, 316
StringIO class, 279
as literals, 38
as sequences, 47
checking characters of, 311
comparing, 43
converting
from non-string values, 11, 304
from objects, 94
to numbers, 11
converting to upper/lowercase, 310–312
encoding/decoding, 310
formatting, 9, 11, 250–253, 310–311
iterating over, 21
methods for, 10
nonempty, 43
number of items in, 10, 306, 310
whitespace in, 312
struct module, 288
struct_time object, 293
__sub__() method, 90
checking classes against, 184, 305
implementing interfaces, 185
subprocess module, 256, 288–289
subtraction, 5
subtypes, see subclasses
sum() function, 15, 47, 128, 312
super() function, 161, 189–192, 199, 207, 313
superclasses, see base classes
symmetric difference operation, 18, 50, 309
symmetric_difference() method, 309
symmetric_difference_update() method, 309
SyntaxError exception, 316, 317
sys.exit() function, 317
sys.getdefaultencoding() method, 259
sys.getfilesystemencoding() function, 257, 264
sys._getframe() function, 132
sys.getrecursionlimit() function, 114
sys.getrefcount() function, 82
sys.modules variable, 227, 232
sys.path variable, 31, 35, 226, 234, 244
sys.setrecursionlimit() function, 114
sys.stderr object, 69, 263–264
sys.stdin, sys.stdout objects, 263–264
SystemError exception, 317
SystemExit exception, 15, 26, 67, 69, 314, 317
TabError exception, 317
teletypewriter (TTY), 281
tell() method, 262
testing
smaller tasks, 145
using file objects for, 279
converting from binary data, 274
encoding/decoding, 13, 248–250, 255, 259
fitting to terminal width, 290
text attribute, 317
TextIOWrapper class, 260
textwrap module, 290
threading module, 271, 291–293
time() function, 293
TimeoutError exception, 316
to_bytes() method, 305
traceback module, 73
__traceback__ attribute, 65, 73, 315
translate() method, 299–300, 312
True value, 6–7, 38, 43–45, 297–298
__truediv__() method, 90
__trunc__() method, 91
truncate() method, 262
truncating division, 5
try statement, 24–25, 64, 66, 110, 141
tuple type, 313
tuple() function, 47
as keys, 52
as sequences, 47
comparing, 42
concatenating, 16
creating, 15
indexing, 16
returning values from functions with, 23, 109
slicing, 16
unpacking, 16
using in dictionaries, 19
turtle module, 319
type hints, 107, 129, 155, 179–180, 222
creating methods from, 197
module-level, 242
type() function, 70, 80, 154, 217, 313
TypeError exception, 43, 68, 95, 101, 103, 122, 191, 211, 305, 317
checking values against, 81, 305
types module, 313
UDP servers, 287
unary minus/plus, 5
UnboundLocalError exception, 68, 111, 317
Unicode encoding
code-point values in, 307
in source code, 2
operations on text strings in, 294–295
UnicodeError exception, 67–68, 249, 317
UnicodeXXXError exceptions, 317
union() method, 309
unittest module, 319
universal newline mode, 260
UNIX
EOF character on, 2
executing files on, 3
low-level I/O control operations on, 278
newline characters on, 260
path separators on, 281
unpack() function, 288
urlencode(), urlopen(), urlparse() functions, 293–294
urllib.parse package, 294
UserDict, UserList, UserString classes, 168
UTF-8 encoding, 2, 13, 249–250
ValueError exception, 25, 67–68, 317
checking against types, 81, 305
minimum/maximum, 307
reducing, 128
updating in place, 41
variables, 3
local, 24, 111–113, 134, 149–151
names of, 3
reassigning, 108
starred, 46
type hints for, 107
unbound, 317
vars() function, 313
venv command, 36
virtual environment, 36
walrus operator, see := operator
warning() function, 281
__weakref__ attribute, 206
web servers, 279
while statement, 4, 7–9, 12, 39, 60–62
Windows
EOF character on, 2
executing files on, 3
failed system calls on, 318
newline characters on, 260
path separators on, 281
WindowsError exception, 318
with statement, 12, 25, 75–77, 99, 202, 256, 289–290
wrap() function, 290
writable() method, 262
write() function, 265
write_through attribute, 263
writelines() method, 262
xml.etree package, 295
__xor__() method, 90
yield statement, 97, 139–142, 265
used as an expression, 146–147