"It is not a matter of fact, but it’s not worth it."
Guido van rossum
Python is a programming language in which it is pleasant to write and which is pleasant to read. We offer thirteen lectures of the
fall course of the CS Center to look deep into the language and try to understand how to use all its features. Lectures are given by
Sergey Lebedev , a developer at JetBrains and a teacher at the Computer Science Center.
It is not enough to master the syntax to learn a programming language: you need to recognize the idioms of the language and learn how to use them. During the course, Sergey introduces listeners to the idioms and capabilities of the Python language.
The photo was taken in the fall of 2014 in Strasbourg, two weeks before the first reading of this course.Course Lectures
Videos of all the lectures
in the playlist on YouTube.
Who, when and why invented the language Python. Interpreters language. Syntax of a bird's-eye view language. IPython interactive shell.
')
Syntax of the declaration of functions. Packing and unpacking arguments. Key arguments and default arguments. Unpacking and assignment operator. Scopes, LEGB rule,
global
and
nonlocal
. Functional programming, anonymous functions. Functions
map
,
filter
and
zip
. Generators lists, sets and dictionaries. A bit about PEP 8.
The syntax of decorators. Decorators with arguments, no arguments. Examples of the use of decorators. Module
functools
.
String literals and raw strings. Strings and Unicode. The main methods of working with strings.
string
module. Bytes Encodings Files and file objects. Methods of working with files. Module
io
.
And again the built-in collections: a tuple, a list, a set, a dictionary — crawl in depth, an overview of methods, examples. Almost everything about the
collections
module: named tuples, counters,
defaultdict
,
OrderedDict
.
Class declaration syntax. Attributes related and unrelated methods,
__dict__
,
__slots__
. Static methods and class methods. Properties, decorator @property. Inheritance, method overloading and super function. Class decorators. Magical methods.
Exceptions, why they are needed and how to handle them. Built-in exceptions and base classes
BaseException
and
Exception
. Operators
try...except..else..finally
. Context managers and the
contextlib
module.
Two iterator protocols:
__next__
+
__iter__
and
__getitem__
. Iterators and
for
loops, as well as
in
and
not in
operators. Generators, operator expression
yield
. Generators like: iterators, coroutines, context managers. Module
itertools
.
Modules. The
import
and
from ... import
statements. Packages. Relative and absolute imports.
__init__
-facade. And again the
import
statement is a detour in depth.
Descriptors: what-how-why. Constructor
__new__
, class
type
and metaclasses. Inheritance of built-in types.
abc
and
collections.abc
modules.
Why test? Interpreter Testing and Docs.
unittest
module. Package
py.test
- much better. Testing properties and
hypothesis
package.
Measurement of Python code operation time using
timeit
,
cProfile
and
line_profiler
. A little about NumPy. JIT and AOT compile Python code using the example of Numba and Cython.
The modules are
threading
,
queue
and
concurrent.futures
. Using threads for parallel computing in Python. GIL. Parallelism and competitiveness.
asyncio
module Module
multiprocessing
.
What's next
Practical tasks of this course are available only to students of the CS Center, students
are recruited once a year, in spring. For those who for some reason cannot study at the center, we recommend not to stop watching the video of the course, but try to solve their everyday tasks in Python, because the main thing in learning a language is practice.
For different languages there are lists of good libraries, for example,
Awesome Java ,
Awesome R and
Awesome C ++ . Of course, there is such a list for
Python . The next time you need a library for working with a database, logging or analyzing images, feel free to go to the appropriate section of the list for inspiration.