Telegram Group & Telegram Channel
Генераторы

В этом посте освежим знания про генераторы, чтобы далее разобрать такую интересную тему, как корутины.

Функции-генераторы выглядят как и обычные, но содержат выражения с ключевым словом yield для последовательного генерирования значений. В целом, генератор – это особый, более изящный случай итератора.

Вызов подобной функции вернёт не значение, а объект генератора. Далее из этого объекта можно получать значения, например, с помощью функции next или циклом for.

Если генератору больше нечего возвращать, то будет вызвано исключение StopIteration.

#генераторы



tg-me.com/python_academy/229
Create:
Last Update:

Генераторы

В этом посте освежим знания про генераторы, чтобы далее разобрать такую интересную тему, как корутины.

Функции-генераторы выглядят как и обычные, но содержат выражения с ключевым словом yield для последовательного генерирования значений. В целом, генератор – это особый, более изящный случай итератора.

Вызов подобной функции вернёт не значение, а объект генератора. Далее из этого объекта можно получать значения, например, с помощью функции next или циклом for.

Если генератору больше нечего возвращать, то будет вызвано исключение StopIteration.

#генераторы

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/229

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

Telegram today rolling out an update which brings with it several new features.The update also adds interactive emoji. When you send one of the select animated emoji in chat, you can now tap on it to initiate a full screen animation. The update also adds interactive emoji. When you send one of the select animated emoji in chat, you can now tap on it to initiate a full screen animation. This is then visible to you or anyone else who's also present in chat at the moment. The animations are also accompanied by vibrations. This is then visible to you or anyone else who's also present in chat at the moment. The animations are also accompanied by vibrations.

Telegram hopes to raise $1bn with a convertible bond private placement

The super secure UAE-based Telegram messenger service, developed by Russian-born software icon Pavel Durov, is looking to raise $1bn through a bond placement to a limited number of investors from Russia, Europe, Asia and the Middle East, the Kommersant daily reported citing unnamed sources on February 18, 2021.The issue reportedly comprises exchange bonds that could be converted into equity in the messaging service that is currently 100% owned by Durov and his brother Nikolai.Kommersant reports that the price of the conversion would be at a 10% discount to a potential IPO should it happen within five years.The minimum bond placement is said to be set at $50mn, but could be lowered to $10mn. Five-year bonds could carry an annual coupon of 7-8%.

Python Academy from ye


Telegram Python Academy
FROM USA