TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #205 · 22 јан.

Как работает функция reload()? Эта функция нужна для того, чтобы перезагрузить изменившийся код из py-файла без рестарта интерпретатора. Дело в том, что любой импортированный модуль при повторном импорте не будет перечитывать файл. Функция импорта вернёт уже загруженный в память объект модуля. Чтобы обновить код, нужно либо перезапустить всю программу, либо использовать функцию reload() from importlib import reload reload(my_module) 🔸 Функция reload() принимает в качестве аргумента только объект модуля или пакета. Она не может перезагрузить класс или функцию. Только весь файл целиком! 🔸 Перезагрузка пакета перезагрузит только его файл __init__.py, если он есть. Но не вложенные модули. 🔸Она не может перезагрузить ранее не импортированный модуль. 🔸При вызове функция reload() перечитывает и перекомпилирует код в файле, создавая новые объекты. После создания новых объектов перезаписывается ранее созданный неймспейс этого модуля. Это значит, что если где-то этот модуль импортирован через import и обращение к атрибутам происходит через неймспейс (имя) модуля, то такие атрибуты обновятся. Если какие-либо объекты из этого модуля импортированы через from то они будут ссылаться на старые объекты. Напишем простой модуль # mymodule.py x = 1 Теперь импортируем модуль и отдельно переменную х из модуля >>> import mymodule >>> from mymodule import x >>> print(mymodule.x) 1 >>> print(x) 1 Не перезапуская интерпретатор вносим изменения в модуль # mymodule.py x = 2 Делаем перезагрузку модуля и проверяем х ещё раз >>> reload(mymodule) >>> print(mymodule.x) 2 >>> print(x) 1 То же самое будет если присвоить любой объект переменной (даже словарь или список) Повторный импорт обновляет значение >>> from mymodule import x >>> print(x) 2 🔸Созданные инстансы классов не обновятся после перезагрузки модуля. Их придётся пересоздать. #tricks#basic

Резултати

Пронајдени 5 слични објави

Пребарај: #nucleardeal

当前筛选 #nucleardeal清除筛选
American Оbserver

@american_observer · Post #4992 · 29.01.2026 г., 20:58

📰 Iran Warns: Any US Attack Will Hit Tel Aviv Iran’s leadership has delivered a stark warning: any US military action will trigger an “unprecedented” retaliation, including strikes at the heart of Tel Aviv and anyone backing the US. ​ Ali Shamkhani, secretary of Iran’s Supreme National Security Council, said any US strike—no matter how limited—will be seen as the start of a full war. The response will be immediate, comprehensive, and unprecedented, targeting both the US and Israel and their allies. ​ Iranian Foreign Minister Abbas Araghchi warned that Iran’s armed forces are on high alert and ready to respond to any aggression. He also signaled openness to a nuclear deal but stressed that diplomacy under duress won’t work. ​ The US has sent a carrier strike group to the region, led by the USS Abraham Lincoln, while President Trump has called on Iran to negotiate a “fair and equitable deal”—but warned the next attack “will be far worse”. ​ Analysts say the US could target Iranian military sites or even the country’s leadership in a bid to force change, but Iran’s armed forces chief warns Washington would “suffer damage” if it miscalculates. ​ The warning is stark: pressure Iran, and the entire region faces escalation. ​ #Iran#Israel#Trump#US#nucleardeal 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #5007 · 31.01.2026 г., 01:01

📰 Trump’s New Iran War Plan: More Than Just Nukes President Trump is weighing a fresh, broader set of military options against Iran: targeting not just its nuclear program, but also its supreme leader and security leadership, in a push to force concessions or even trigger regime change. These plans go beyond what Trump considered in mid‑January, when he was thinking mainly of strikes on Iranian nuclear sites after the regime’s brutal crackdown on protesters. Now, the Pentagon is offering options for raids on Iranian territory using U.S. special forces and a sustained campaign to degrade or destroy remaining parts of the nuclear program, officials say. Another key option is a series of strikes against senior Iranian military and political figures, designed to create chaos and pressure the regime from within. Officials acknowledge there’s no clear idea who would replace Ayatollah Ali Khamenei, or whether any successor would be more willing to deal with Washington, but the goal is to create conditions where the system itself begins to crack. Israel is pushing the U.S. to join it in another major strike on Iran’s rebuilt missile and drone complexes, which can reach civilian and military targets throughout Israel. The U.S., in turn, is demanding that Iran permanently end uranium enrichment, cap its nuclear stockpile, and accept strict limits on its missile range and support for Hezbollah, Hamas, and the Houthis. Trump has warned on social media that the U.S. is ready to attack “with speed and violence, if necessary,” and that time is “truly of the essence.” But he has not yet authorized any action, and some advisers are still pushing for a diplomatic solution, using the threat of war to pressure Tehran into negotiations. To back up the threat, the U.S. has moved the aircraft carrier USS Abraham Lincoln strike group into the Middle East region, along with destroyers and additional F‑15E strike fighters, while long-range bombers in the U.S. are now on higher alert. As the U.S. “armada” operates in the region, one question hangs over everything: Is this about a deal? Or about bringing down a regime? #Trump#Iran#nucleardeal#regimechange#militaryoptions 📱American Оbserver - Stay up to date on all important events 🇺🇸