Python скачать
Содержание:
- Major new features of the 3.9 series, compared to 3.8
- Major new features of the 3.8 series, compared to 3.7
- This is the tenth and final regular maintenance release of Python 3.8
- And now for something completely different
- And now for something completely different
- OpenPGP Public Keys
- Other Useful Items
- Major new features of the 3.8 series, compared to 3.7
- This is the fourth maintenance release of Python 3.9
- Шаг 2: Подготовьте вашу систему
- Установка Python 3 на Debian
- Установка Python 3.6 на Ubuntu
- And Now For Something Completely Different
- Other Useful Items
- Major new features of the 3.8 series, compared to 3.7
- Циклы for, while в Питоне
- Язык программирования Python
- Major new features of the 3.9 series, compared to 3.8
- Major new features of the 3.9 series, compared to 3.8
- Подсистема Windows для Linux (WSL)
Major new features of the 3.9 series, compared to 3.8
Some of the new major new features and changes in Python 3.9 are:
- PEP 573, Module State Access from C Extension Methods
- PEP 584, Union Operators in
- PEP 585, Type Hinting Generics In Standard Collections
- PEP 593, Flexible function and variable annotations
- PEP 602, Python adopts a stable annual release cadence
- PEP 614, Relaxing Grammar Restrictions On Decorators
- PEP 615, Support for the IANA Time Zone Database in the Standard Library
- PEP 616, String methods to remove prefixes and suffixes
- PEP 617, New PEG parser for CPython
- BPO 38379, garbage collection does not block on resurrected objects;
- BPO 38692, os.pidfd_open added that allows process management without races and signals;
- BPO 39926, Unicode support updated to version 13.0.0;
- BPO 1635741, when Python is initialized multiple times in the same process, it does not leak memory anymore;
- A number of Python builtins (range, tuple, set, frozenset, list, dict) are now sped up using PEP 590 vectorcall;
- A number of Python modules (_abc, audioop, _bz2, _codecs, _contextvars, _crypt, _functools, _json, _locale, operator, resource, time, _weakref) now use multiphase initialization as defined by PEP 489;
- A number of standard library modules (audioop, ast, grp, _hashlib, pwd, _posixsubprocess, random, select, struct, termios, zlib) are now using the stable ABI defined by PEP 384.
You can find a more comprehensive list in this release’s «What’s New» document.
Major new features of the 3.8 series, compared to 3.7
- PEP 572, Assignment expressions
- PEP 570, Positional-only arguments
- PEP 587, Python Initialization Configuration (improved embedding)
- PEP 590, Vectorcall: a fast calling protocol for CPython
- PEP 578, Runtime audit hooks
- PEP 574, Pickle protocol 5 with out-of-band data
- Typing-related: PEP 591 (Final qualifier), PEP 586 (Literal types), and PEP 589 (TypedDict)
- Parallel filesystem cache for compiled bytecode
- Debug builds share ABI as release builds
- f-strings support a handy specifier for debugging
- is now legal in blocks
- on Windows, the default event loop is now
- on macOS, the spawn start method is now used by default in
- can now use shared memory segments to avoid pickling costs between processes
- is merged back to CPython
- is now 40% faster
- now uses Protocol 4 by default, improving performance
There are many other interesting changes, please consult the «What’s New» page in the documentation for a full list.
This is the tenth and final regular maintenance release of Python 3.8
Note: The release you’re looking at is Python 3.8.10, a bugfix release for the legacy 3.8 series. Python 3.9 is now the latest feature release series of Python 3. Get the latest release of 3.9.x here.
According to the release calendar specified in PEP 569, Python 3.8.10 is the final regular maintenance release. Starting now, the 3.8 branch will only accept security fixes and releases of those will be made in source-only form until October 2024.
Compared to the 3.7 series, this last regular bugfix release is relatively dormant at 92 commits since 3.8.9. Version 3.7.8, the final regular bugfix release of Python 3.7, included 187 commits. But there’s a bunch of important updates here regardless, the biggest being Big Sur and Apple Silicon build support. This work would not have been possible without the effort of Ronald Oussoren, Ned Deily, Maxime Bélanger, and Lawrence D’Anna from Apple. Thank you!
Take a look at the change log for details.
And now for something completely different
trong>Mr Anemone (Graham Chapman): Mr Chigger. So, you want to learn to fly?
Mr Chigger (Terry Jones): Yes.
Mr Anemone: Right, well, up on the table, arms out, fingers together, knees bent…
Mr Chigger: No, no, no.
Mr Anemone: (very loudly) UP ON THE TABLE! (Mr Chigger gets on the table) Arms out, fingers together, knees bent, now, head well forward. Now, flap your arms. Go on, flap, faster… faster… faster… faster, faster, faster, faster — now JUMP! (Mr Chigger jumps and lands on the floor) Rotten. You’re no bloody use at all. You’re an utter bloody wash-out. You make me sick, you weed!
Mr Chigger: Now look here…
Mr Anemone: All right, all right. I’ll give you one more chance, get on the table…
Mr Chigger: Look, I came here to learn how to fly an aeroplane.
Mr Anemone: A what?
Mr Chigger: I came here to learn how to fly an aeroplane.
Mr Anemone: (sarcastically) Oh, ‘an aeroplane’. Oh, I say, we are grand, aren’t we? (imitation posh accent) ‘Oh, oh, no more buttered scones for me, mater. I’m off to play the grand piano’. ‘Pardon me while I fly my aeroplane.’ NOW GET ON THE TABLE!
Version | Operating System | Description | MD5 Sum | File Size | GPG |
---|---|---|---|---|---|
Gzipped source tarball | Source release | a7c10a2ac9d62de75a0ca5204e2e7d07 | 24067487 | SIG | |
XZ compressed source tarball | Source release | 3000cf50aaa413052aef82fd2122ca78 | 17912964 | SIG | |
macOS 64-bit installer | macOS | for OS X 10.9 and later | dd5e7f64e255d21f8d407f39a7a41ba9 | 30119781 | SIG |
Windows help file | Windows | 4aeeebd7cc8dd90d61e7cfdda9cb9422 | 8568303 | SIG | |
Windows x86-64 embeddable zip file | Windows | for AMD64/EM64T/x64 | c12ffe7f4c1b447241d5d2aedc9b5d01 | 8175801 | SIG |
Windows x86-64 executable installer | Windows | for AMD64/EM64T/x64 | fd2458fa0e9ead1dd9fbc2370a42853b | 27805800 | SIG |
Windows x86-64 web-based installer | Windows | for AMD64/EM64T/x64 | 17e989d2fecf7f9f13cf987825b695c4 | 1364136 | SIG |
Windows x86 embeddable zip file | Windows | 8ee09403ec0cc2e89d43b4a4f6d1521e | 7330315 | SIG | |
Windows x86 executable installer | Windows | 452373e2c467c14220efeb10f40c231f | 26744744 | SIG | |
Windows x86 web-based installer | Windows | fe72582bbca3dbe07451fd05ece1d752 | 1325800 | SIG |
And now for something completely different
>Michelangelo: Good evening, your Holiness.
Pope: Evening, Michelangelo. I want to have a word with you about this painting of yours, «The Last Supper.»
Michelangelo: Oh, yeah?
Pope: I’m not happy about it.
Michelangelo: Oh, dear. It took me hours.
Pope: Not happy at all.
Michelangelo: Is it the jellies you don’t like?
Pope: No.
Michelangelo: Of course not, they add a bit of color, don’t they? Oh, I know, you don’t like the kangaroo?
Pope: What kangaroo?
Michelangelo: No problem, I’ll paint him out.
Pope: I never saw a kangaroo!
Michelangelo: Uuh… he’s right in the back. I’ll paint him out! No sweat, I’ll make him into a disciple.
Version | Operating System | Description | MD5 Sum | File Size | GPG |
---|---|---|---|---|---|
Gzipped source tarball | Source release | f9f3768f757e34b342dbc06b41cbc844 | 24007411 | SIG | |
XZ compressed source tarball | Source release | e9d6ebc92183a177b8e8a58cad5b8d67 | 17869888 | SIG | |
macOS 64-bit installer | macOS | for OS X 10.9 and later | f12203128b5c639dc08e5a43a2812cc7 | 30023420 | SIG |
Windows help file | Windows | 7506675dcbb9a1569b54e600ae66c9fb | 8507261 | SIG | |
Windows x86-64 embeddable zip file | Windows | for AMD64/EM64T/x64 | 1a98565285491c0ea65450e78afe6f8d | 8017771 | SIG |
Windows x86-64 executable installer | Windows | for AMD64/EM64T/x64 | b5df1cbb2bc152cd70c3da9151cb510b | 27586384 | SIG |
Windows x86-64 web-based installer | Windows | for AMD64/EM64T/x64 | 2586cdad1a363d1a8abb5fc102b2d418 | 1363760 | SIG |
Windows x86 embeddable zip file | Windows | 1b1f0f0c5ee8601f160cfad5b560e3a7 | 7147713 | SIG | |
Windows x86 executable installer | Windows | 6f0ba59c7dbeba7bb0ee21682fe39748 | 26481424 | SIG | |
Windows x86 web-based installer | Windows | 04d97979534f4bd33752c183fc4ce680 | 1325416 | SIG |
OpenPGP Public Keys
Source and binary executables are signed by the release manager using their
OpenPGP key. The release managers and binary builders since Python 2.3 have
been:
- Anthony Baxter (key id: 6A45C816)
- Georg Brandl (key id: )
- Martin v. Löwis (key id: 7D9DC8D2)
- Benjamin Peterson (key id: 18ADD4FF and A4135B38)
- Barry Warsaw (key ids: A74B06BF, EA5BBD71, and ED9D77D5)
- Ronald Oussoren (key id: E6DF025C)
- Ned Deily (key id: 6F5E1540)
- Larry Hastings (key id: F73C700D)
Note: Barry’s key id A74B06BF is used to sign the Python 2.6.8 and 2.6.9
releases. His key id EA5BBD71 was used to sign all other Python 2.6 and 3.0
releases. His key id ED9D77D5 is a v3 key and was used to sign older
releases.
You can import the release manager public keys by either downloading
the public key file from here and then
running
% gpg --import pubkeys.txt
or by grabbing the individual keys directly from the keyserver network
by running this command:
% gpg --recv-keys 6A45C816 36580288 7D9DC8D2 18ADD4FF A4135B38 A74B06BF EA5BBD71 ED9D77D5 E6DF025C 6F5E1540 F73C700D
On the version-specific download pages, you should see a link to both the
downloadable file and a detached signature file. To verify the authenticity
of the download, grab both files and then run this command:
% gpg --verify Python-3.4.0.tgz.asc
Note that you must use the name of the signature file, and you should use the
one that’s appropriate to the download you’re verifying.
Other Useful Items
- Looking for 3rd party Python modules? The
Package Index has many of them. - You can view the standard documentation
online, or you can download it
in HTML, PostScript, PDF and other formats. See the main
Documentation page. - Information on tools for unpacking archive files
provided on python.org is available. -
Tip: even if you download a ready-made binary for your
platform, it makes sense to also download the source.
This lets you browse the standard library (the subdirectory Lib)
and the standard collections of demos (Demo) and tools
(Tools) that come with it. There’s a lot you can learn from the
source! - There is also a collection of Emacs packages
that the Emacsing Pythoneer might find useful. This includes major
modes for editing Python, C, C++, Java, etc., Python debugger
interfaces and more. Most packages are compatible with Emacs and
XEmacs.
Want to contribute? See the Python Developer’s Guide
to learn about how Python development is managed.
Python is OSI Certified Open Source:
(, ) The binaries for AMD64 will also work on processors that implement the Intel 64 architecture (formerly EM64T), i.e. the architecture that Microsoft calls x64, and AMD called x86-64 before calling it AMD64. They will not work on Intel Itanium Processors (formerly IA-64). |
(, , , ) There is important information about IDLE, Tkinter, and Tcl/Tk on Mac OS X here. |
Major new features of the 3.8 series, compared to 3.7
- PEP 572, Assignment expressions
- PEP 570, Positional-only arguments
- PEP 587, Python Initialization Configuration (improved embedding)
- PEP 590, Vectorcall: a fast calling protocol for CPython
- PEP 578, Runtime audit hooks
- PEP 574, Pickle protocol 5 with out-of-band data
- Typing-related: PEP 591 (Final qualifier), PEP 586 (Literal types), and PEP 589 (TypedDict)
- Parallel filesystem cache for compiled bytecode
- Debug builds share ABI as release builds
- f-strings support a handy specifier for debugging
- is now legal in blocks
- on Windows, the default event loop is now
- on macOS, the spawn start method is now used by default in
- can now use shared memory segments to avoid pickling costs between processes
- is merged back to CPython
- is now 40% faster
- now uses Protocol 4 by default, improving performance
There are many other interesting changes, please consult the «What’s New» page in the documentation for a full list.
This is the fourth maintenance release of Python 3.9
Python 3.9.4 is a hotfix release addressing an unintentional ABI incompatibility introduced in Python 3.9.3. Upgrading is highly recommended to all users. Details in bpo-43710.
To reiterate, Python 3.9.3 was itself an expedited release due to its security content:
- bpo-43631: high-severity CVE-2021-3449 and CVE-2021-3450 were published for OpenSSL, it’s been upgraded to 1.1.1k in CI, and macOS and Windows installers.
- bpo-42988: CVE-2021-3426: Remove the getfile feature of the pydoc module which could be abused to read arbitrary files on the disk (directory traversal vulnerability). Moreover, even source code of Python modules can contain sensitive data like passwords. Vulnerability reported by David Schwörer.
- bpo-43285: ftplib no longer trusts the IP address value returned from the server in response to the PASV command by default. This prevents a malicious FTP server from using the response to probe IPv4 address and port combinations on the client network. Code that requires the former vulnerable behavior may set a trust_server_pasv_ipv4_address attribute on their ftplib.FTP instances to True to re-enable it.
- bpo-43439: Add audit hooks for gc.get_objects(), gc.get_referrers() and gc.get_referents(). Patch by Pablo Galindo.
Шаг 2: Подготовьте вашу систему
Существует несколько специфичных для дистрибутива шагов, связанных с получением Python с нуля. Суть каждого шага одинакова для всех дистрибутивов, но вам может понадобиться перевести ваш дистрибутив, если в нем не используется apt-get:
Первый шаг, который вам нужно сделать, выполняя такую операцию – это обновление системных пакетов на вашем компьютере перед началом. В Debian, это будет выглядеть следующим образом:
Shell
$ sudo apt-get update
$ sudo apt-get upgrade
1 2 |
$sudo apt-getupgrade |
Далее, нам нужно убедиться в том, что система содержит инструменты, необходимые для установки Python. Их очень много, и у вас в распоряжении уже могут иметься некоторые из них. Я отсортировал их в одной командной строке, но вы можете разбить список на короткие команды.
Shell
# Для apt-систем (таких как Debian, Ubuntu и Mint)
$ sudo apt-get install -y make liblzma-dev lzma build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev
# Для yum-систем (таких, как CentOS)
$ sudo yum -y groupinstall development
$ sudo yum -y install zlib-devel
1 2 3 4 5 6 |
# Для apt-систем (таких как Debian, Ubuntu и Mint) $sudo apt-getinstall-ymakeliblzma-dev lzma build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev $sudo yum-ygroupinstall development $sudo yum-yinstall zlib-devel |
Установка Python 3 на Debian
Мы нашли ресурсы, в которых указано, что метод Ubuntu 16.10 (смотрим выше) будет работать и с Debian, но нам так и не удалось найти рабочий способ для Debian 9. Вместо этого, мы получили альтернативный способ установки Python, указанный ниже.
Одна загвоздка с Debian: как правило, он не устанавливает команду sudo по умолчанию. Чтобы установить её, вам нужно сделать следующее, прежде чем приступить к дальнейшим инструкциям:
Shell
$ su
$ apt-get install sudo
$ vi /etc/sudoers
1 2 3 |
$su $apt-getinstall sudo $vietcsudoers |
После этого, нужно открыть файл /etc/sudoers при помощи команды sudo в vim (или в другом текстовом редакторе, который вы предпочитаете). Добавьте следующую строку текста в конец файла, заменив your_username с вашим пользовательским именем:
Shell
your_username ALL=(ALL) ALL
1 | your_username ALL=(ALL)ALL |
Установка Python 3.6 на Ubuntu
В зависимости от версии Ubuntu, с которым вы работаете, варьируются и инструкции по установке Python. Вы можете определить вашу локальную версию Ubuntu, выполнив следующую команду:
Shell
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial
1 2 3 4 5 6 |
$lsb_release-a No LSB modules are available. Distributor IDUbuntu DescriptionUbuntu16.04.4LTS Release16.04 Codenamexenial |
Следуйте следующим инструкциям в зависимости от номера версии, который виден под надписью Release в выдаче консоли:
Ubuntu 17.10, Ubuntu 18.04 предоставляет Python 3.6 по умолчанию. Вы можете вызвать его по команде python3.
Ubuntu 16.10 и Ubuntu 17.04 не предоставляют Python 3.6 по умолчанию, однако он доступен в репозитории Universe. Вы можете установить его, выполнив следующие команды:
Shell
$ sudo apt-get update
$ sudo apt-get install python3.6
1 2 |
$sudo apt-getupdate $sudo apt-getinstall python3.6 |
Вы можете вызвать его по команде python3.6.
Если вы используете Ubuntu 14.04 или Ubuntu 16.04, Python 3.6 не будет находиться в репозитории Universe, так что вам нужно получить его из архива Personal Package Archive (PPA). Например, для установки Python из PPA, выполните следующую команду:
Shell
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt-get update
$ sudo apt-get install python3.6
1 2 3 |
$sudo add-apt-repository ppadeadsnakesppa $sudo apt-getupdate $sudo apt-getinstall python3.6 |
Как и ранее, его можно вызвать при помощи команды python3.6.
And Now For Something Completely Different
trong>Mr. Praline (John Cleese): ‘ELLO POLLY!!! Testing! Testing! This is your nine o’clock alarm call!
(Takes parrot out of the cage , throws it up in the air and watches it plummet to the floor.)
Mr. Praline: Now that’s what I call a dead parrot.
Owner (Michael Palin): No, no… No, he’s stunned!
Mr. Praline: STUNNED?!
Owner: Yeah! You stunned him, just as he was wakin’ up! Norwegian Blues stun easily, major.
Mr. Praline: Um… now look, mate. I’ve definitely ‘ad enough of this. That parrot is definitely deceased, and when I purchased it not ‘alf an hour ago, you assured me that its total lack of movement was due to it bein’ tired and shagged out following a prolonged squawk.
Owner: Well, he’s… he’s, ah… probably pining for the fjords.
Version | Operating System | Description | MD5 Sum | File Size | GPG |
---|---|---|---|---|---|
Gzipped source tarball | Source release | 83d71c304acab6c678e86e239b42fa7e | 24720640 | SIG | |
XZ compressed source tarball | Source release | d9eee4b20155553830a2025e4dcaa7b3 | 18433456 | SIG | |
macOS 64-bit Intel installer | macOS | for macOS 10.9 and later | 690ddb1be403a7efb202e93f3a994a49 | 29896827 | SIG |
macOS 64-bit universal2 installer | macOS | experimental, for macOS 11 Big Sur and later; recommended on Apple Silicon | ae8a1ae082074b260381c058d0336d05 | 37300939 | SIG |
Windows embeddable package (32-bit) | Windows | 659adf421e90fba0f56a9631f79e70fb | 7348969 | SIG | |
Windows embeddable package (64-bit) | Windows | 3acb1d7d9bde5a79f840167b166bb633 | 8211403 | SIG | |
Windows help file | Windows | a06af1ff933a13f6901a75e59247cf95 | 8597086 | SIG | |
Windows installer (32-bit) | Windows | b355cfc84b681ace8908ae50908e8761 | 27204536 | SIG | |
Windows installer (64-bit) | Windows | Recommended | 62cf1a12a5276b0259e8761d4cf4fe42 | 28296784 | SIG |
Other Useful Items
- Looking for 3rd party Python modules? The
Package Index has many of them. - You can view the standard documentation
online, or you can download it
in HTML, PostScript, PDF and other formats. See the main
Documentation page. - Information on tools for unpacking archive files
provided on python.org is available. -
Tip: even if you download a ready-made binary for your
platform, it makes sense to also download the source.
This lets you browse the standard library (the subdirectory Lib)
and the standard collections of demos (Demo) and tools
(Tools) that come with it. There’s a lot you can learn from the
source! - There is also a collection of Emacs packages
that the Emacsing Pythoneer might find useful. This includes major
modes for editing Python, C, C++, Java, etc., Python debugger
interfaces and more. Most packages are compatible with Emacs and
XEmacs.
Major new features of the 3.8 series, compared to 3.7
- PEP 572, Assignment expressions
- PEP 570, Positional-only arguments
- PEP 587, Python Initialization Configuration (improved embedding)
- PEP 590, Vectorcall: a fast calling protocol for CPython
- PEP 578, Runtime audit hooks
- PEP 574, Pickle protocol 5 with out-of-band data
- Typing-related: PEP 591 (Final qualifier), PEP 586 (Literal types), and PEP 589 (TypedDict)
- Parallel filesystem cache for compiled bytecode
- Debug builds share ABI as release builds
- f-strings support a handy specifier for debugging
- is now legal in blocks
- on Windows, the default event loop is now
- on macOS, the spawn start method is now used by default in
- can now use shared memory segments to avoid pickling costs between processes
- is merged back to CPython
- is now 40% faster
- now uses Protocol 4 by default, improving performance
There are many other interesting changes, please consult the «What’s New» page in the documentation for a full list.
Циклы for, while в Питоне
Выше упоминалось, что ряд объектов Питона является итерируемым. Это значит, что элементы этой сущности можно перебирать. Для этого в том числе нужны циклы (особенно for).
Конструкция цикла for представлена следующим образом:
Либо:
Другими словами, мы можем проходиться по каждому элементу последовательности либо напрямую, либо при помощи функции range и индексов.
Для понимания рассмотрим примеры.
Результат работы скрипта:
При помощи цикла for мы вывели на печать все имеющиеся в списке планеты. Такого же результата можно добиться через индексы (на основании длины списка). Функция range генерирует целые числа в заданном диапазоне. Так как всего у нас 5 планет, то в нее можно передать параметр 5. С другой стороны, для этого также подойдет длина списка.
Результат работы скрипта (нижеследующее выведется 2 раза):
Цикл while требует условие выхода, так как в противном случае может выполняться бесконечно. Хоть может и показаться, что эта бесконечность не нужна, в ряде случаев без нее никак: например, показывать окно программы до тех пор, пока пользователь ее не закрыл.
Реализуем следующую задумку: выведем все числа от 50 до 100 включительно, которые делятся на 7, но не делятся на 2.
Результат работы скрипта:
Всего таких числа 3
Важно не забыть на каждой итерации увеличивать исходное число, иначе оно никогда не станет равным 100
Язык программирования Python
Последнее обновление: 06.11.2020
Python представляет популярный высокоуровневый язык программирования, который предназначен для создания приложений различных типов.
Это и веб-приложения, и игры, и настольные программы, и работа с базами данных.
Довольно большое распространение питон получил в области машинного обучения и исследований искусственного интеллекта.
Основные особенности языка программирования Python:
-
Скриптовый язык. Код программ определяется в виде скриптов.
-
Поддержка самых различных парадигм программирования, в том числе объектно-ориентированной и функциональной парадигм.
-
Интерпретация программ. Для работы со скриптами необходим интерпретатор, который запускает и выполняет скрипт.
Выполнение программы на Python выглядит следующим образом. Сначала мы пишим в текстовом редакторе скрипт с набором выражений на данном языке программирования. Передаем этот скрипт
на выполнение интерпретатору. Интерпретатор транслирует код в промежуточный байткод, а затем виртуальная машина переводит полученный байткод в набор инструкций, которые выполняются операционной системой.Здесь стоит отметить, что хотя формально трансляция интерпретатором исходного кода в байткод и перевод байткода виртуальной машиной в набор машинных команд представляют
два разных процесса, но фактически они объединены в самом интерпретаторе. -
Портативность и платформонезависимость. Не имеет значения, какая у нас операционная система — Windows, Mac OS, Linux, нам достаточно написать скрипт, который будет запускаться на всех этих ОС
при наличии интерпретатора -
Автоматическое управление памяти
-
Динамическая типизация
Python — очень простой язык программирования, он имеет лаконичный и в то же время довольно простой и понятный синтаксис. Соответственно его
легко изучать, и собственно это одна из причин, по которой он является одним из самых популярных языков программирования именно для обучения. В частности, в 2014 году он был
признан самым популярным языком программирования для обучения в США.
Python также популярен не только в сфере обучения, но в написании конкретных программ в том числе коммерческого характера. В немалой степени
поэтому для этого языка написано множество библиотек, которые мы можем использовать.
Кроме того, у данного языка программирования очень большое коммьюнити, в интернете можно найти по данному языку множество полезных материалов, примеров, получить
квалифицированную помощь специалистов.
Установка Python
По нажатию на кнопку будет загружен соответствующей текущей ОС установщик Python.
На ОС Windows при запуске инсталлятора запускает окно мастера установки:
Здесь мы можем задать путь, по которому будет устанавливаться интерпретатор. Оставим его по умолчанию, то есть
C:\Users\\AppData\Local\Programs\Python\Python36\.
Кроме того, в самом низу отметим флажок «Add Python 3.9 to PATH», чтобы добавить путь к интерпретатору в переменные среды.
После установки в меню Пуск на ОС Windows мы сможем найти иконки для доступа к разным утилитам питона:
Здесь утилита Python 3.9 (64-bit) представляет интерпретатор, в котором мы можем запустить скрипт. В файловой системе сам файл интерпретатора можно найти по пути,
по которому производилась установка. На Windows по умолчанию это путь C:\Users\\AppData\Local\Programs\Python\Python37, а сам интерпретатор представляет
файл python.exe. На ОС Linux установка производится по пути /usr/local/bin/python3.9.
Вперед
Major new features of the 3.9 series, compared to 3.8
Some of the new major new features and changes in Python 3.9 are:
- PEP 573, Module State Access from C Extension Methods
- PEP 584, Union Operators in
- PEP 585, Type Hinting Generics In Standard Collections
- PEP 593, Flexible function and variable annotations
- PEP 602, Python adopts a stable annual release cadence
- PEP 614, Relaxing Grammar Restrictions On Decorators
- PEP 615, Support for the IANA Time Zone Database in the Standard Library
- PEP 616, String methods to remove prefixes and suffixes
- PEP 617, New PEG parser for CPython
- BPO 38379, garbage collection does not block on resurrected objects;
- BPO 38692, os.pidfd_open added that allows process management without races and signals;
- BPO 39926, Unicode support updated to version 13.0.0;
- BPO 1635741, when Python is initialized multiple times in the same process, it does not leak memory anymore;
- A number of Python builtins (range, tuple, set, frozenset, list, dict) are now sped up using PEP 590 vectorcall;
- A number of Python modules (_abc, audioop, _bz2, _codecs, _contextvars, _crypt, _functools, _json, _locale, operator, resource, time, _weakref) now use multiphase initialization as defined by PEP 489;
- A number of standard library modules (audioop, ast, grp, _hashlib, pwd, _posixsubprocess, random, select, struct, termios, zlib) are now using the stable ABI defined by PEP 384.
You can find a more comprehensive list in this release’s «What’s New» document.
Major new features of the 3.9 series, compared to 3.8
Some of the new major new features and changes in Python 3.9 are:
- PEP 573, Module State Access from C Extension Methods
- PEP 584, Union Operators in
- PEP 585, Type Hinting Generics In Standard Collections
- PEP 593, Flexible function and variable annotations
- PEP 602, Python adopts a stable annual release cadence
- PEP 614, Relaxing Grammar Restrictions On Decorators
- PEP 615, Support for the IANA Time Zone Database in the Standard Library
- PEP 616, String methods to remove prefixes and suffixes
- PEP 617, New PEG parser for CPython
- BPO 38379, garbage collection does not block on resurrected objects;
- BPO 38692, os.pidfd_open added that allows process management without races and signals;
- BPO 39926, Unicode support updated to version 13.0.0;
- BPO 1635741, when Python is initialized multiple times in the same process, it does not leak memory anymore;
- A number of Python builtins (range, tuple, set, frozenset, list, dict) are now sped up using PEP 590 vectorcall;
- A number of Python modules (_abc, audioop, _bz2, _codecs, _contextvars, _crypt, _functools, _json, _locale, operator, resource, time, _weakref) now use multiphase initialization as defined by PEP 489;
- A number of standard library modules (audioop, ast, grp, _hashlib, pwd, _posixsubprocess, random, select, struct, termios, zlib) are now using the stable ABI defined by PEP 384.
You can find a more comprehensive list in this release’s «What’s New» document.
Подсистема Windows для Linux (WSL)
Если вы используете Windows 10 Creators или Anniversary Update, существует другой способ установки Python. Эти версии Windows 10 включают в себя функцию под названием Windows Subsystem for Linux, которая позволяет вам запустить среду Linux прямо в Windows без изменений и без дополнительных нагрузок в виртуальном компьютере.
- Для дополнительной информации, вы можете ознакомиться с документацией подсистемы Windows для Linux на сайте Microsoft;
- Для инструкций по подключению подсистемы в Windows 10 и установки дистрибутива Linux, вы можете ознакомиться с руководством Windows 10;
- Также, вы можете посмотреть презентацию Сары Кули на YouTube, одной из участников команды разработчиков WSL.
После установки подходящего дистрибутива Linux, вы можете установить Python 3 в консольном окне Bash, как если бы вы запускали дистрибутив Linux напрямую (смотреть ниже).