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 слични објави

Пребарај: #denguefever

当前筛选 #denguefever清除筛选

📜 We are aware of the #DengueFever outbreak reported in Sokoto State. Based on a dynamic risk assessment, the current risk level of the dengue outbreak has been determined to be MODERATE. However, measures have been taken by the National Emerging Viral Haemorrhagic Diseases Technical Working Group and partners to control the outbreak and prevent the further spread. 🔗Press release https://ncdc.gov.ng/news/506/ncdc-on-alert-following-the-confirmation-of-the-dengue-fever-outbreak-in-sokoto-state.

Hashtags

In November 2025, 29 suspected cases of dengue fever were recorded, with 6 confirmed and 1 death reported. Between January and November 2025, a total of 735 suspected cases were reported across the country among both adults and children. These figures highlight the importance of continued vigilance and preventive action. Protect Yourself. Avoid mosquito bites by: ✅ Keeping your surroundings clean and free of stagnant water ✅ Supporting community clean-up efforts to reduce mosquito breeding sites ✅ Visit the nearest health facility early if you feel unwell Full Sitrep: https://ncdc.gov.ng/themes/common/files/sitreps/903d9215ad81cbdee39f6b098f3eea97.pdf #DengueFever#StaySafe # NCDCNigeria

Mosquitoes are carriers of various diseases, including #Malaria, #YellowFever, #DengueFever, and #ZikaVirus, with cases rising during the rainy season. You can protect yourself: ➡Eliminate stagnant water to prevent mosquito breeding ➡Use mosquito repellent and wear clothing that covers your arms and legs ➡Sleep under insecticide-treated mosquito nets ➡Keep drainages and gutters clear ➡Install screens on doors and windows #WorldMosquitoDay

Common Viral Haemorrhagic Fevers #VHFs include #LassaFever, #EbolaVirusDisease, #YellowFever, #DengueFever, #MarburgFever and #CrimeanCongoHaemorrhagicFever. What are the #InfectionPreventionandControl practices that need to be in place in the management of VHFs? 🔗Download our National Guideline on #IPC for #VHF https://ncdc.gov.ng/themes/common/docs/protocols/111_1579986179.pdf