diff --git a/docs/en/SUMMARY.md b/docs/en/SUMMARY.md index 398512af..ffb3d611 100644 --- a/docs/en/SUMMARY.md +++ b/docs/en/SUMMARY.md @@ -84,6 +84,7 @@ * [LED strip (legacy)](leds_old.md) * [Contribution Guidelines](contributing.md) * [Migration to v0.20](migrate20.md) + * [Migration to v0.22](migrate22.md) * [Clover-based projects](projects.md) * [Drone show](clever-show.md) * [Innopolis Open 2020 (L22_ÆRO)](innopolis_open_L22_AERO.md) diff --git a/docs/en/migrate22.md b/docs/en/migrate22.md new file mode 100644 index 00000000..c788796a --- /dev/null +++ b/docs/en/migrate22.md @@ -0,0 +1,49 @@ +# Migration to version 0.20 + +## Python 3 transition + +Python 2 is deprecated since January 1st, 2020. The Clover platform moves to Python 3. + +For running flight script instead of `python` command: + +```bash +python flight.py +``` + +use `python3` command: + +```bash +python3 flight.py +``` + +Python 3 has certain syntax differences in comparison with the old version. Instead of `print` *operator*: + +```python +print 'Clover is the best' +``` + +use `print` *function*: + +```python +print('Clover is the best') +``` + +The division operator operates floating points by default (instead of integer). Python 2: + +```python +>>> 10 / 4 +2 +``` + +Python 3: + +```python +>>> 10 / 4 +2.5 +``` + +For strings `unicode` type is used by default (instead of `str` type). + +Encoding specification (`# coding: utf8`) is not necessary any more. + +More details on all the language changes see in [appropriate article](https://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html). diff --git a/docs/ru/SUMMARY.md b/docs/ru/SUMMARY.md index 2260f6d2..cdbc59d2 100644 --- a/docs/ru/SUMMARY.md +++ b/docs/ru/SUMMARY.md @@ -90,6 +90,7 @@ * [Светодиодная лента (legacy)](leds_old.md) * [Вклад в Клевер](contributing.md) * [Переход на версию 0.20](migrate20.md) + * [Переход на версию 0.22](migrate22.md) * [Мероприятия](events.md) * [CopterHack-2021](copterhack2021.md) * [CopterHack-2019](copterhack2019.md) diff --git a/docs/ru/migrate22.md b/docs/ru/migrate22.md new file mode 100644 index 00000000..8c3d6493 --- /dev/null +++ b/docs/ru/migrate22.md @@ -0,0 +1,49 @@ +# Переход на версию 0.22 + +## Переход на Python 3 + +Python 2 был признан [устаревшим](https://www.python.org/doc/sunset-python-2/), начиная с 1 января 2020 года. Платформа Клевера переходит на использование Python 3. + +Для запуска полетных скриптов вместо команды `python`: + +```bash +python flight.py +``` + +теперь следует использовать команду `python3`: + +```bash +python3 flight.py +``` + +Синтаксис языка Python 3 имеет определенные изменения по сравнения со второй версией. Вместо *оператора* `print`: + +```python +print 'Clover is the best' +``` + +теперь используется *функция* `print`: + +```python +print('Clover is the best') +``` + +Оператор деления по умолчанию выполняет деление с плавающей точкой (вместо целочисленного). Python 2: + +```python +>>> 10 / 4 +2 +``` + +Python 3: + +```python +>>> 10 / 4 +2.5 +``` + +Для строк по умолчанию теперь используется тип `unicode` (вместо типа `str`). + +Указание кодировки файла (`# coding: utf8`) перестало быть необходимым. + +Полное описание всех изменений языка смотрите в [соответствующей статье](https://pythonworld.ru/osnovy/python2-vs-python3-razlichiya-sintaksisa.html).