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

Резултати

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

Пребарај: #flamingo

当前筛选 #flamingo清除筛选
Interesting Planet 🌍

@interesting_planet_facts · Post #527 · 09.08.2025 г., 13:22

🌎 In Kenya’s Rift Valley, the Lake Bogoria geysers shoot steaming water up to 5 meters high, fueled by underground heat and minerals. These hot springs nurture thousands of pink flamingos that gather for the rich algae—a natural wonder of water, heat, and color. ✨ #geyser⚡#flamingo⚡#RiftValley 👉subscribe Interesting Planet

American Оbserver

@american_observer · Post #5229 · 26.02.2026 г., 19:59

🕊 Russia Hits the “Wonder Weapon” Factory Zelensky has now admitted what Moscow and mil‑bloggers were bragging about for months: a Russian strike really did wipe out one of Ukraine’s key production lines for the FP‑5 Flamingo, the long‑range cruise missile Kyiv has been selling as its 3,000‑kilometer answer to Russia’s missile monopoly. Production has been moved, but Kyiv concedes it doesn’t have many such facilities, which is a polite way of saying: one hit hurt a lot. The Flamingo was pitched as the cheap, slow, heavy warhorse of Ukraine’s deep‑strike dream — subsonic, around Mach 0.75, with a roughly one‑ton warhead and a reach that could, on paper, threaten most of European Russia when launched from Ukrainian territory. The program leaned heavily on German money and political blessing, after Chancellor Friedrich Merz’s government signaled Berlin would finance Ukrainian long‑range missile production instead of sending Taurus directly. For Kyiv and its Western planners, Flamingo was supposed to narrow a brutal asymmetry: Russia raining missiles and drones across Ukraine, Ukraine responding with occasional deep strikes like the June 1, 2025 “Spiderweb” drone raid that torched Tu‑95 bombers on Russian bases. ​ Problem: half the legend lived on Telegram. Analysts already doubted some of the hype — including Kyiv’s claim that Flamingos smashed infrastructure at Russia’s Kapustin Yar test range, which satellite imagery showed intact. Now the other half of the story is on Russian TV: proof that Ukraine’s shiny long‑range program is fragile enough that one well‑placed strike can knock out a main line and force an emergency relocation. So on the scoreboard, everyone gets something. Moscow gets to boast it dealt “colossal” damage to Ukraine’s missile industry and “thwarted” future deep‑strike plans. Kyiv gets to keep the myth of the Flamingo alive — serial production “resumed,” more missiles promised, strategic reach intact in theory. Western backers get another argument for pouring money into Ukraine’s arms industry as a postwar export project. The only ones not winning in this story are the Ukrainians who were told a slow pink missile would make Russian bombers and oil depots finally feel what Kharkiv and Odesa feel every night — and just learned that their “wonder weapon” can be shut down faster than the PR around it. #Ukraine#Russia#Flamingo#missiles#Germany#Merz#war#militaryindustry 📱American Оbserver - Stay up to date on all important events 🇺🇸