ABSTRACT

Python is a mature, general-purpose language popular in scripting, web frameworks, and data science. It was created and is still overseen by Guido van Rossum. This chapter focuses on many of the Python's modern features, including named parameter associations, default and keyword arguments, list comprehensions, its mechanism for custom operator definition, and its support for iterators and generators. Python, like CoffeeScript, uses indentation to define structure. Python variables are either global or scoped to a function. There is no explicit variable declaration; assigning to a variable inside a function creates a local variable, unless marked global or nonlocal. Unlike CoffeeScript, Python locals shadow globals of the same name. An iterable is an object that produces a sequence of values. Lists, tuples, sets, dictionaries, and objects of a few other built-in types are iterables. Writing iterables and iterators from scratch can be a bit tedious, so Python provides generators to simplify the creation of iterable sequences.