Telegram Group & Telegram Channel
​​Создание функций на основе других с "замороженными" параметрами

Привет, сегодня поговорим про очень важную функцию partial из пакета functools. Более подробно мы рассказываем про это в курсе, но сейчас дадим краткое описание работы.

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

Например, можем создать функцию, которая умножает два числа, а потом "заморозить" один аргумент, как на картинке.



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

​​Создание функций на основе других с "замороженными" параметрами

Привет, сегодня поговорим про очень важную функцию partial из пакета functools. Более подробно мы рассказываем про это в курсе, но сейчас дадим краткое описание работы.

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

Например, можем создать функцию, которая умножает два числа, а потом "заморозить" один аргумент, как на картинке.

BY Python Academy




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

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

Tata Power whose core business is to generate, transmit and distribute electricity has made no money to investors in the last one decade. That is a big blunder considering it is one of the largest power generation companies in the country. One of the reasons is the company's huge debt levels which stood at ₹43,559 crore at the end of March 2021 compared to the company’s market capitalisation of ₹44,447 crore.

Telegram auto-delete message, expiring invites, and more

elegram is updating its messaging app with options for auto-deleting messages, expiring invite links, and new unlimited groups, the company shared in a blog post. Much like Signal, Telegram received a burst of new users in the confusion over WhatsApp’s privacy policy and now the company is adopting features that were already part of its competitors’ apps, features which offer more security and privacy. Auto-deleting messages were already possible in Telegram’s encrypted Secret Chats, but this new update for iOS and Android adds the option to make messages disappear in any kind of chat. Auto-delete can be enabled inside of chats, and set to delete either 24 hours or seven days after messages are sent. Auto-delete won’t remove every message though; if a message was sent before the feature was turned on, it’ll stick around. Telegram’s competitors have had similar features: WhatsApp introduced a feature in 2020 and Signal has had disappearing messages since at least 2016.

Python Academy from ua


Telegram Python Academy
FROM USA