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

Резултати

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

Пребарај: #zatoka

当前筛选 #zatoka清除筛选
DruschbaFM - English

@druschbaFm_en · Post #52374 · 21.03.2025 г., 08:06

⚡️ 🇷🇺 🇺🇦⚔️ Ukraine Fronts on the Morning of 21 March⚡️ 🔴#Sumy Direction: 🔴In #Sudzha Sector, to the west near #Zhuravka the RFAF are around 2 km deep in Ukrainian lands. The village itself, is ca. 50% under Russian control. 🟡#Basovka, to the southeast, is about 70% seized. 🟡#Novenkoye, further north, is Russian controlled. The AFU have abandoned the settlement. 🟡 The border zone to the east is grey zone. 🟡#Rubanshchina in #Kursk region, is Russian controlled. 🟡#Gogolevka to its east is still under AFU control. 🟡 Southeast of #Gogolevka, the RFAF expanded their zone of control. The wedge is also north #Melovoy, the control of which is unclear (AFU or Grey Zone). 🟡#Oleshnyaremains safe under AFU control. 🟡#Guyevo is likely still AFU controlled, the RFAF expanded their zone and have advanced close to its northern edge. 🟡#Gornal remains safe under AFU control. 📌 As a Result, there no cauldron for now. UAV and artillery are working on both sides. In fact, the AFU losses are far higher than the RFAF's, which is well documented by objective evidence. This, due to the AFU Command's decision to hold the remaining villages at any costs. 🔴 In #KrasnayaYaruga Sector, south of #Sudhza in Russian #Belgorod region, the AFU assaults continue with focus on #Demidovka, where AFU infantry could entrench at its southern edge. Shooting battles have been reported. According to unconfirmed reports, the village ruins are still Russian controlled. 🟡#Grafovka to its southeast remains under firm Russian control. 🟡#Prilesye also further south. 🗺 All on Map 1 📌 The AFU Command, following significant losses of tanks and armoured vehicles, has changed its tactics. Attacks are now only carried out by infantry groups with drone and artillery support. 🔴 In #Kharkov Direction and at #Svatovo Front, there are no major changes. 🔴#ChasovYar Direction: 🔴In #ChasovYar Sector, no changes. 🔴In #Toretsk Sector, northeast of the city, the reported RFAF advance towards #Ozeryanovka has been confirmed by footage. 🟡 At #Druzhba, the RFAF expanded the zone of control north of the village by around 600m. 🟡 In #Toretsk, the RFAF had tactical successes. 🔴#Pokrovsk Direction: 🔴 On the right Flank, the AFU counterattack and managed to push back Russian units in the area of ​​the 'Malinovskaya junction.' 🟡#Tarasovka has been entered by Russian assault groups, which managed to expand the control zone in the village by 400m. 🗺 Map 2 🎬 Video 🟡 In #Yelizavetovka, there are heavy counterbattles. 🔴 South of the City, contrary to earlier reports, #Shevchenko village is still embattled. Russian troops expanded their zone of control. 🗺 Map 3 🔴 On the left Flank, heavy fighting without significant changes. 🔴#Komar Direction: 🔴In #Konstantinopol Sector, the battles incl. for #Konstantinopol itself continue, no major changes. 🔴 In #Komar Sector, heavy fighting continues. According to field reports, the Russian troops have entered the southern outskirts of #Vesyoloye. 🔴#Zaporozhye Direction: 🔴In the #Orekhov Section, bloody battles for #Shcherbaki and #MalyeShcherbaki, as well as on the approaches to #Lobkovoye continue. 🔴 In #Kherson Direction, the AFU struck civil targets. 💥#OldRussia: 🔵In #Kursk Region, the AFU struck and destroyed the 'Sudzha Gas Transmission System,' through which gas from #Russia was supplied to the #EU. In #Rostov region, a UAV attack was repelled at night. In the #DPR, 1 civilian was killed and 4 wounded by AFU attacks on civilian targets. 💥#RestUkraine: 🔵 In #Odessa Region, several Geranium UAV hits have been reported, incl. at the 'Telekart-Pribor Plant' in #Odessa. Explosions occurred also in #Zatoka, #Kiev, #Poltava, #Zaporozhye, and #Cherkassy regions. 🎞 Video Source 🗺 Maps @olegtsarov; @creamy_caprice 📋 Sources: CC; Tsarov; ⚡️2M; 🇺🇦Fiend;😼Kotenok 🕰As of 21 Mar 2025; 06:42 GMT+3;📃20 Mar 📱 Join GLOBAL DEPTH to boost your TG Feed 💬Join Military Chat for Comments & Discussions 🇺🇦On Ukraine Observer you will find your daily independent Ukraine War Battle Update