Паттерн Декоратор — специальный способ организации модулей в программе, который позволяет подставить какую-то новую функцию прямо в середину цепочки вызовов, тем самым чуть-чуть подкорректировав поведение.
Например, в реальном мире очки для чтения это декоратор. Вы ставите их между вашими глазами и текстом. Глобально взаимодействие ваших глаз и текста не меняется: отражённые световые лучи от страницы книги попадают в ваши зрачки, что с очками, что без них. Но очки располагаются посередине: они принимают лучи на вход и преломляют их, передавая дальше вам в глаза уже изменёнными.
Важной особенностью является тот факт, что очки можно снять. Они не требуют ни модификации вашего тела, ни модификации книги. Вообще никакие условия не нужны, кроме наличия самих очков. А если вы в линзах, то внешний наблюдатель может даже этого не знать.
Класс-декоратор должен быть спроектирован так, чтобы не требовать никаких изменений в объектах, с которыми он работает. Его можно отключить, чаще всего буквально закомментировав одну строку.
В примере ниже программа выведет текст "Привет, мир, в натуре.", и вот это дополнение в конце как раз дописано декоратором. Можно убрать или закомментировать подчёркнутую строчку, не трогая остальной код, для всех внешних вызовов сигнатуры останутся теми же самыми, но выводиться будет уже просто "Привет, мир".
В декораторы можно прятать логику, которую буквально навешивают поверх основной функции программы. Например, проверку прав на выполнение операции. Перевод на другой язык, логирование, поддержку обратной совместимости при обновлении и так далее.
#dev
@RusEmbMalta Press release
On the anniversary of the Declaration of Ukraine’s independence
🔷 On August 24, 2024, Kiev celebrated a state holiday – the #Independence Day of Ukraine.
The Kiev regime keeps trying to boast about its supposed “victories”, successful banderization and forced ukrainianization. It is the geopolitical and mercantile interests of the West that in fact stand behind its “support”
of Ukraine, while this country is assigned the role of a “puppet” and “cannon fodder”.
🔷 The representatives of Zelensky's junta hardly dare to publicly discuss the violation of the provisions adopted in July 1990.
🔷 The heirs of Goebbels do not mention the real losses of the country and the missed opportunities during 33 years of “independence”, total depopulation and loss of whole industries. Kiev got into complete dependence on financial and material submits of the West, for which future generations of Ukrainians will have to pay.
Read in full here
Since 1380, Iceland was ruled by Denmark. On December 1, 1918, Iceland became its own country with the same king as Denmark. In 1940, Iceland started making its own big decisions. On June 17, 1944, Iceland became a republic and stopped having a king.
👑🇮🇸
[Source]
@googlefactss#Iceland#History#Independence#FunFacts
🌍 Qadrli yurtdoshlar!
🇺🇿 O‘zbekiston Respublikasi Vazirlar Mahkamasi huzuridagi Biznes va tadbirkorlik oliy maktabi jamoasi barchangizni 18-noyabr – “O‘zbekiston Respublikasining Davlat bayrog‘i qabul qilingan kun” bilan muborakbod etadi!
🇺🇿 Mustaqilligimiz hamda tinchligimiz ramzi bayrog‘imiz, g‘urur va faxrimiz timsoli yuksaklarda abadiy hilpirab tursin!
#GraduateSchool#Uzbekistan#Flag#Independence
🔝Web-site |🔝Facebook | 🔝Instagram | 🔝Youtube
🇺🇿Biznes va tadbirkorlik oliy maktabi barcha yurtdoshlarimizni mustaqilligimizning 34 yilligi bilan muborakbod etadi.
🇺🇿Mustaqillik - yurtni, millatni birlashtiradigan yagona kuch, ko‘p millatli halqimizning irodasi, uning hurriyat haqidagi azaliy orzularidir.
🦅 Vatanimiz osmoni musaffo, sarhadlari daxlsiz, chegaralarimiz mustahkam, hayotimiz yana-da farovon, mustaqilligimiz va ravnaqimiz abadiy bo‘lsin!
#GraduateSchool#Independence#34years#Development
🔝Web-site |🔝Facebook |🔝Instagram | 🔝Youtube
🇺🇿Biznes va tadbirkorlik oliy maktabi barcha yurtdoshlarimizni mustaqilligimizning 33 yilligi bilan muborakbod etadi.
🇺🇿Mustaqillik - yurtni, millatni birlashtiradigan yagona kuch, ko‘p millatli halqimizning irodasi, uning hurriyat haqidagi azaliy orzularidir.
🇺🇿 Vatanimiz osmoni musaffo, sarhadlari daxlsiz, chegaralarimiz mustahkam, hayotimiz yana-da farovon, mustaqilligimiz va ravnaqimiz abadiy bo‘lsin!
🦅Barchamizga yana bir bor O‘zbekistonimiz Mustaqilligining 33 yilligi muborak bo‘lsin!
#GraduateSchool#Independence#33years#Development
🔝Web-site |🔝Facebook |🔝Instagram | 🔝Youtube
🇰🇪 Jamhuri Day (Swahili: “Republic Day”) — is Kenya’s national day, celebrated on December 12. It marks independence from Britain (12 Dec 1963) and becoming a republic (12 Dec 1964). Common observances: flag‑raising, presidential speeches, parades, cultural performances, and civic ceremonies. If you’re Kenyan or were there during the festivities, share your photos. @googlefactss#JamhuriDay#Kenya#Independence
Siku njema ya Jamhuri kwa Wakenya wote.
8 сентябр Президенти Ҷумҳурии Тоҷикистон, Пешвои миллат муҳтарам Эмомалӣ Раҳмон дар паёми шодбошии худ ба муносибати 33-солагии истиқлоли давлатии Тоҷикистон тамоми мардуми сарбаланди кишвар ва ҳамватанони бурунмарзиамонро самимона табрик гуфта, ба ҳамаи онҳо хонаи обод, саодати рӯзгор, сулҳу оромӣ, ки асоси хушбахтии халқамон ва ободиву сарсабзии Ватани маҳбубамон мебошад, инчунин, комёбиву барори кор орзу намуданд.
8 сентября Президент Республики Таджикистан, Лидер нации уважаемый Эмомали Рахмона в своем поздравительном послании по случаю 33-й годовщины независимости, поздравив народ Таджикистана и зарубежных соотечественников, пожелал всем им семейного благополучия, счастливой жизни, мира и спокойствия, которые являются основой благоустройства нашей любимой Родины, безмятежной жизни народа, а также новых достижений и успехов.
#ЭмомалиРахмон#EmomaliRahmon#Tajikistan#Президент#Таджики#Tajiks#Тоҷикон#Независимость#Independence
President.tj | Facebook | Instagram | Telegram | X | Youtube
Congratulations on the 34th anniversary of independence: Putin tops the list, but Mirziyoyev stresses multi-vector policy. Different priorities for domestic and foreign audiences: Central Asia in the president’s speech and Russia–China in the official greetings.
https://yep.uz/en/2025/09/uzbekistan-34th-independence-day-congratulations/
#uzbekistan#mirziyoyev#independence#putin#xijinping#trump#centralasia#politics#multivector
VCs Retreat from Crypto Market
In 2023, analysts noted a significant decline in venture capital investments in cryptocurrency projects, returning to levels reminiscent of 2017. However, some initiatives are aiming to revive the industry’s original spirit of independence from VC influence, at least in principle. Insights provided by Oleg CasCoin for ForkLog. Read more
#VC#Crypto#Investment#Market#Decline #2017 #ForkLog#OlegCasCoin#Independence#Initiatives#Analysis#Freedom#Trends#Industry#Finance#Blockchain#News#Updates#Economy#Future
🚀 AI TRENDS | OpenAI's Sam Altman Addresses AI Development Concerns and Recent Incident
OpenAI founder Sam Altman has expressed understanding of societal fears regarding the rapid development of artificial intelligence. According to Odaily, Altman acknowledged that the current period is marked by significant technological change, with associated risks escalating to systemic challenges at the societal level. He emphasized that AI power should not be concentrated in a few institutions and advocated for broader distribution through technological democratization and institutional constraints.
Addressing a recent incident where his residence was targeted with a Molotov cocktail, Altman admitted to underestimating the impact of public narratives and emotions amid AI-related anxieties. He also acknowledged mistakes in company governance and conflict management, offering apologies for past actions. Furthermore, Altman reiterated his decision to reject Elon Musk's attempts to control OpenAI, ensuring the company's independent development.
Previously, it was reported that the OpenAI founder's residence was attacked with a Molotov cocktail.
#AI#OpenAI#SamAltman#AIdevelopment#technologicalchange#AIsociety#democratization#institutionalconstraints#Molotovcocktail#publicnarratives#conflictmanagement#ElonMusk#companygovernance#independence